我想对编辑视图DOM根做一些不能通过引擎视图的API完成的事情。为此,我需要在插件的init()
回调中访问DOM根。
然而,事实证明,DOM根是在插件初始化之后创建的。
如何从我的插件访问它?
发布于 2019-04-18 15:50:17
UI实际上是在插件初始化之后初始化的。参见these two lines。
但是,editor.ui
会触发#ready
事件,因此下面的操作将会起作用:
editor.ui.on( 'ready', () => {
const domRoot = editingView.getDomRoot();
// Do something with the DOM root...
} );
https://stackoverflow.com/questions/55741349
复制相似问题