mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-14 13:13:58 +08:00
Merge pull request #2 from ckeditor/mermaid-firefox-toolbar-fix
Fixed toolbar not showing up in firefox.
This commit is contained in:
commit
dc48d61efe
@ -173,6 +173,17 @@ export default class MermaidEditing extends Plugin {
|
|||||||
|
|
||||||
domElement.addEventListener( 'input', debouncedListener );
|
domElement.addEventListener( 'input', debouncedListener );
|
||||||
|
|
||||||
|
/* Workaround for internal #1544 */
|
||||||
|
domElement.addEventListener( 'focus', () => {
|
||||||
|
const model = editor.model;
|
||||||
|
const selectedElement = model.document.selection.getSelectedElement();
|
||||||
|
|
||||||
|
// Move the selection onto the mermaid widget if it's currently not selected.
|
||||||
|
if ( selectedElement !== data.item ) {
|
||||||
|
model.change( writer => writer.setSelection( data.item, 'on' ) );
|
||||||
|
}
|
||||||
|
}, true );
|
||||||
|
|
||||||
return domElement;
|
return domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,7 +228,6 @@ export default class MermaidEditing extends Plugin {
|
|||||||
} else if ( child.name === 'div' && child.hasClass( 'ck-mermaid__preview' ) ) {
|
} else if ( child.name === 'div' && child.hasClass( 'ck-mermaid__preview' ) ) {
|
||||||
// @todo: we could optimize this and not refresh mermaid if widget is in source mode.
|
// @todo: we could optimize this and not refresh mermaid if widget is in source mode.
|
||||||
const domPreviewWrapper = domConverter.viewToDom( child, window.document );
|
const domPreviewWrapper = domConverter.viewToDom( child, window.document );
|
||||||
// console.log( child, domPreviewWrapper );
|
|
||||||
|
|
||||||
if ( domPreviewWrapper ) {
|
if ( domPreviewWrapper ) {
|
||||||
domPreviewWrapper.innerHTML = newSource;
|
domPreviewWrapper.innerHTML = newSource;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user