diff --git a/examples/expressions_explorer/public/render_expressions.tsx b/examples/expressions_explorer/public/render_expressions.tsx index 20a8b56edb3f8..d91db964c5352 100644 --- a/examples/expressions_explorer/public/render_expressions.tsx +++ b/examples/expressions_explorer/public/render_expressions.tsx @@ -34,7 +34,9 @@ interface Props { } export function RenderExpressionsExample({ expressions, inspector }: Props) { - const [expression, updateExpression] = useState('markdown "## expressions explorer rendering"'); + const [expression, updateExpression] = useState( + 'markdownVis "## expressions explorer rendering"' + ); const expressionChanged = (value: string) => { updateExpression(value); diff --git a/examples/expressions_explorer/public/run_expressions.tsx b/examples/expressions_explorer/public/run_expressions.tsx index a635fab7ec8ae..93cab0e9f2b6f 100644 --- a/examples/expressions_explorer/public/run_expressions.tsx +++ b/examples/expressions_explorer/public/run_expressions.tsx @@ -35,7 +35,7 @@ interface Props { } export function RunExpressionsExample({ expressions, inspector }: Props) { - const [expression, updateExpression] = useState('markdown "## expressions explorer"'); + const [expression, updateExpression] = useState('markdownVis "## expressions explorer"'); const [result, updateResult] = useState({}); const expressionChanged = (value: string) => { diff --git a/test/examples/expressions_explorer/expressions.ts b/test/examples/expressions_explorer/expressions.ts index 4c240653b5fdd..9aef64a392a7b 100644 --- a/test/examples/expressions_explorer/expressions.ts +++ b/test/examples/expressions_explorer/expressions.ts @@ -22,7 +22,7 @@ export default function ({ getService }: PluginFunctionalProviderContext) { await retry.try(async () => { const text = await testSubjects.getVisibleText('expressionResult'); expect(text).to.be( - '{\n "type": "render",\n "as": "markdown",\n "value": {\n "content": "## expressions explorer",\n "font": {\n "type": "style",\n "spec": {\n "fontFamily": "\'Open Sans\', Helvetica, Arial, sans-serif",\n "fontWeight": "normal",\n "fontStyle": "normal",\n "textDecoration": "none",\n "textAlign": "left",\n "fontSize": "14px",\n "lineHeight": "1"\n },\n "css": "font-family:\'Open Sans\', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:left;font-size:14px;line-height:1"\n },\n "openLinksInNewTab": false\n }\n}' + '{\n "type": "render",\n "as": "markdown_vis",\n "value": {\n "visType": "markdown",\n "visParams": {\n "markdown": "## expressions explorer",\n "openLinksInNewTab": false,\n "fontSize": 12\n }\n }\n}' ); }); }); diff --git a/x-pack/plugins/canvas/public/plugin.tsx b/x-pack/plugins/canvas/public/plugin.tsx index 543c159bae145..101f64e53b685 100644 --- a/x-pack/plugins/canvas/public/plugin.tsx +++ b/x-pack/plugins/canvas/public/plugin.tsx @@ -30,8 +30,6 @@ import { Start as InspectorStart } from '../../../../src/plugins/inspector/publi import { BfetchPublicSetup } from '../../../../src/plugins/bfetch/public'; import { PresentationUtilPluginStart } from '../../../../src/plugins/presentation_util/public'; import { getPluginApi, CanvasApi } from './plugin_api'; -import { CanvasSrcPlugin } from '../canvas_plugin_src/plugin'; -import { pluginServices } from './services'; import { pluginServiceRegistry } from './services/kibana'; export { CoreStart, CoreSetup }; @@ -75,14 +73,10 @@ export type CanvasStart = void; export class CanvasPlugin implements Plugin { private appUpdater = new BehaviorSubject(() => ({})); - // TODO: Do we want to completely move canvas_plugin_src into it's own plugin? - private srcPlugin = new CanvasSrcPlugin(); public setup(coreSetup: CoreSetup, setupPlugins: CanvasSetupDeps) { const { api: canvasApi, registries } = getPluginApi(setupPlugins.expressions); - this.srcPlugin.setup(coreSetup, { canvas: canvasApi }); - // Set the nav link to the last saved url if we have one in storage const lastPath = getSessionStorage().get( `${SESSIONSTORAGE_LASTPATH}:${coreSetup.http.basePath.get()}` @@ -101,12 +95,21 @@ export class CanvasPlugin order: 3000, updater$: this.appUpdater, mount: async (params: AppMountParameters) => { - // Load application bundle - const { renderApp, initializeCanvas, teardownCanvas } = await import('./application'); + const { CanvasSrcPlugin } = await import('../canvas_plugin_src/plugin'); + const srcPlugin = new CanvasSrcPlugin(); + srcPlugin.setup(coreSetup, { canvas: canvasApi }); // Get start services const [coreStart, startPlugins] = await coreSetup.getStartServices(); + srcPlugin.start(coreStart, startPlugins); + + const { pluginServices } = await import('./services'); + pluginServices.setRegistry(pluginServiceRegistry.start({ coreStart, startPlugins })); + + // Load application bundle + const { renderApp, initializeCanvas, teardownCanvas } = await import('./application'); + const canvasStore = await initializeCanvas( coreSetup, coreStart, @@ -145,8 +148,6 @@ export class CanvasPlugin } public start(coreStart: CoreStart, startPlugins: CanvasStartDeps) { - this.srcPlugin.start(coreStart, startPlugins); - pluginServices.setRegistry(pluginServiceRegistry.start({ coreStart, startPlugins })); initLoadingIndicator(coreStart.http.addLoadingCountSource); } }