本文整理汇总了TypeScript中tinymce/core/api/Editor.Editor.focus方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Editor.focus方法的具体用法?TypeScript Editor.focus怎么用?TypeScript Editor.focus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tinymce/core/api/Editor.Editor
的用法示例。
在下文中一共展示了Editor.focus方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: prompt
onclick: () => {
const comment = prompt('Comment with?');
ed.annotator.annotate('alpha', {
comment
});
ed.focus();
},
示例2: function
const create = function (editor: Editor, toolbars: ContextToolbar[]) {
const items = createToolbars(editor, toolbars).concat([
Toolbar.create(editor, 'text', Settings.getTextSelectionToolbarItems(editor)),
Toolbar.create(editor, 'insert', Settings.getInsertToolbarItems(editor)),
Forms.createQuickLinkForm(editor, hide)
]);
return Factory.create({
type: 'floatpanel',
role: 'dialog',
classes: 'tinymce tinymce-inline arrow',
ariaLabel: 'Inline toolbar',
layout: 'flex',
direction: 'column',
align: 'stretch',
autohide: false,
autofix: true,
fixed: true,
border: 1,
items: Tools.grep(items, hasToolbarItems),
oncancel () {
editor.focus();
}
});
};
示例3: execute
execute(table, targets).each(function (rng) {
resizeChange(editor, beforeSize, table);
editor.selection.setRng(rng);
editor.focus();
cellSelection.clear(table);
Util.removeDataStyle(table);
});
示例4: restoreDraft
const restoreLastDraft = (editor: Editor) => {
editor.undoManager.transact(() => {
restoreDraft(editor);
removeDraft(editor);
});
editor.focus();
};
示例5: function
const execCommand = function (command, ui, value, args) {
let func, customCommand, state = false;
if (editor.removed) {
return;
}
if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$/.test(command) && (!args || !args.skip_focus)) {
editor.focus();
} else {
SelectionBookmark.restore(editor);
}
args = editor.fire('BeforeExecCommand', { command, ui, value });
if (args.isDefaultPrevented()) {
return false;
}
customCommand = command.toLowerCase();
if ((func = commands.exec[customCommand])) {
func(customCommand, ui, value);
editor.fire('ExecCommand', { command, ui, value });
return true;
}
// Plugin commands
each(editor.plugins, function (p) {
if (p.execCommand && p.execCommand(command, ui, value)) {
editor.fire('ExecCommand', { command, ui, value });
state = true;
return false;
}
});
if (state) {
return state;
}
// Theme commands
if (editor.theme && editor.theme.execCommand && editor.theme.execCommand(command, ui, value)) {
editor.fire('ExecCommand', { command, ui, value });
return true;
}
// Browser commands
try {
state = editor.getDoc().execCommand(command, ui, value);
} catch (ex) {
// Ignore old IE errors
}
if (state) {
editor.fire('ExecCommand', { command, ui, value });
return true;
}
return false;
};
示例6: function
const initEditor = function (editor: Editor) {
editor.bindPendingEventDelegates();
editor.initialized = true;
editor.fire('init');
editor.focus(true);
editor.nodeChanged({ initial: true });
editor.execCallback('init_instance_callback', editor);
autoFocus(editor);
};
示例7:
const deleteImage = (editor: Editor, image: HTMLElement) => {
if (image) {
const elm = editor.dom.is(image.parentNode, 'figure.image') ? image.parentNode : image;
editor.dom.remove(elm);
editor.focus();
editor.nodeChanged();
if (editor.dom.isEmpty(editor.getBody())) {
editor.setContent('');
editor.selection.setCursorLocation();
}
}
};
示例8: function
const togglePlainTextPaste = function (editor: Editor, clipboard: Clipboard, userIsInformedState) {
if (clipboard.pasteFormat.get() === 'text') {
clipboard.pasteFormat.set('html');
Events.firePastePlainTextToggle(editor, false);
} else {
clipboard.pasteFormat.set('text');
Events.firePastePlainTextToggle(editor, true);
if (shouldInformUserAboutPlainText(editor, userIsInformedState)) {
displayNotification(editor, 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.');
userIsInformedState.set(true);
}
}
editor.focus();
};
示例9: create
const insertImageAtCaret = (editor: Editor, data: ImageData) => {
const elm = create((css) => normalizeCss(editor, css), data);
editor.dom.setAttrib(elm, 'data-mce-id', '__mcenew');
editor.focus();
editor.selection.setContent(elm.outerHTML);
const insertedElm = editor.dom.select('*[data-mce-id="__mcenew"]')[0];
editor.dom.setAttrib(insertedElm, 'data-mce-id', null);
if (isFigure(insertedElm)) {
const figure = splitTextBlock(editor, insertedElm);
editor.selection.select(figure);
} else {
editor.selection.select(insertedElm);
}
};
示例10: toggleClass
const toggleReadOnly = (editor: Editor, state: boolean) => {
toggleClass(Element.fromDom(editor.getBody()), 'mce-content-readonly', state);
if (state) {
editor.selection.controlSelection.hideResizeRect();
editor.readonly = true;
editor.getBody().contentEditable = 'false';
} else {
editor.readonly = false;
editor.getBody().contentEditable = 'true';
setEditorCommandState(editor, 'StyleWithCSS', false);
setEditorCommandState(editor, 'enableInlineTableEditing', false);
setEditorCommandState(editor, 'enableObjectResizing', false);
editor.focus();
editor.nodeChanged();
}
};