-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* TINY-10304: Fixed broken non-editable root advlist test (#9091) * TINY-10304: Properly toggle editable root state * TINY-10304: Try using the specific editor container * TINY-10304: dump the whole page state * TINY-10304: added missing AdvList plugin to hook init * TINY-10304: Restored sync test and re-enabled all tests * TINY-10304: Added changelog to mcagar * TINY-10304: Added v6.5 API checking for mcagar TinyState
- Loading branch information
Showing
4 changed files
with
24 additions
and
10 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
16 changes: 12 additions & 4 deletions
16
modules/mcagar/src/main/ts/ephox/mcagar/api/bdd/TinyState.ts
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 |
---|---|---|
@@ -1,14 +1,22 @@ | ||
import { Editor as EditorType } from '../../alien/EditorTypes'; | ||
|
||
const setEditableRoot = <T extends EditorType = EditorType>(editor: T, state: boolean) => { | ||
if (editor.setEditableRoot) { | ||
editor.setEditableRoot(state); | ||
} else { | ||
throw new Error('setEditableRoot requires at least TinyMCE v6.5'); | ||
} | ||
}; | ||
|
||
export const withNoneditableRootEditor = <T extends EditorType = EditorType>(editor: T, f: (editor: T) => void): void => { | ||
editor.getBody().contentEditable = 'false'; | ||
setEditableRoot(editor, false); | ||
f(editor); | ||
editor.getBody().contentEditable = 'true'; | ||
setEditableRoot(editor, true); | ||
}; | ||
|
||
export const withNoneditableRootEditorAsync = async <T extends EditorType = EditorType>(editor: T, f: (editor: T) => Promise<void>): Promise<void> => { | ||
editor.getBody().contentEditable = 'false'; | ||
setEditableRoot(editor, false); | ||
await f(editor); | ||
editor.getBody().contentEditable = 'true'; | ||
setEditableRoot(editor, true); | ||
}; | ||
|
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