-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: prevent inline toolbar from closing in nested instance of editor (…
…#2780) * fix: prevent inline toolbar from closing in nested instance of editor * docs: updated changelog.md with fix description * fix: fix import to use `type` --------- Co-authored-by: Peter <[email protected]>
- Loading branch information
Showing
4 changed files
with
89 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type { BlockTool, BlockToolConstructorOptions } from '../../../../types'; | ||
import { createEditorWithTextBlocks } from './createEditorWithTextBlocks'; | ||
|
||
export const NESTED_EDITOR_ID = 'nested-editor'; | ||
|
||
/** | ||
* Creates nested Editor instance with paragraph block | ||
*/ | ||
export default class NestedEditor implements BlockTool { | ||
private data: { text: string }; | ||
|
||
constructor(value: BlockToolConstructorOptions) { | ||
this.data = value.data; | ||
} | ||
|
||
public render(): HTMLDivElement { | ||
const editorEl = Object.assign(document.createElement('div'), { | ||
id: NESTED_EDITOR_ID, | ||
}); | ||
|
||
editorEl.setAttribute('data-cy', NESTED_EDITOR_ID); | ||
|
||
createEditorWithTextBlocks([ this.data.text ], { holder: NESTED_EDITOR_ID }); | ||
|
||
return editorEl; | ||
} | ||
|
||
public save(): string { | ||
return this.data.text; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters