本文整理汇总了TypeScript中tinymce/core/api/Editor.Editor.isDirty方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Editor.isDirty方法的具体用法?TypeScript Editor.isDirty怎么用?TypeScript Editor.isDirty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tinymce/core/api/Editor.Editor
的用法示例。
在下文中一共展示了Editor.isDirty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
editor.on('KeyUp', function (e) {
const keyCode = e.keyCode;
// If key is prevented then don't add undo level
// This would happen on keyboard shortcuts for example
if (e.isDefaultPrevented()) {
return;
}
if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode === 45 || e.ctrlKey) {
addNonTypingUndoLevel();
editor.nodeChanged();
}
if (keyCode === 46 || keyCode === 8) {
editor.nodeChanged();
}
// Fire a TypingUndo/Change event on the first character entered
if (isFirstTypedCharacter && self.typing && Levels.isEq(Levels.createFromEditor(editor), data[0]) === false) {
if (editor.isDirty() === false) {
setDirty(true);
editor.fire('change', { level: data[0], lastLevel: null });
}
editor.fire('TypingUndo');
isFirstTypedCharacter = false;
editor.nodeChanged();
}
});
示例2: Date
const storeDraft = (editor: Editor) => {
const prefix = Settings.getAutoSavePrefix(editor);
if (!isEmpty(editor) && editor.isDirty()) {
LocalStorage.setItem(prefix + 'draft', editor.getContent({ format: 'raw', no_events: true }) as string);
LocalStorage.setItem(prefix + 'time', new Date().getTime().toString());
Events.fireStoreDraft(editor);
}
};