本文整理汇总了TypeScript中tinymce/core/api/Editor.execCommand函数的典型用法代码示例。如果您正苦于以下问题:TypeScript execCommand函数的具体用法?TypeScript execCommand怎么用?TypeScript execCommand使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了execCommand函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const applyColour = function (editor: Editor, format, value, onChoice: (v: string) => void) {
if (value === 'custom') {
const dialog = colorPickerDialog(editor);
dialog((colorOpt) => {
colorOpt.each((color) => {
Settings.addColor(color);
editor.execCommand('mceApplyTextcolor', format, color);
onChoice(color);
});
}, '#000000');
} else if (value === 'remove') {
onChoice('');
editor.execCommand('mceRemoveTextcolor', format);
} else {
onChoice(value);
editor.execCommand('mceApplyTextcolor', format, value);
}
};
示例2:
optRange.each((range) => {
editor.selection.setRng(range);
if (pattern.type === 'inline-format') {
pattern.format.forEach((format) => {
editor.formatter.apply(format);
});
} else {
editor.execCommand(pattern.cmd, false, pattern.value);
}
});
示例3: function
editor.on('focus', function () {
if (!autoUrlDetectState) {
autoUrlDetectState = true;
try {
editor.execCommand('AutoUrlDetect', false, true);
} catch (ex) {
// Ignore
}
}
});
示例4: setFocusedRange
editor.undoManager.transact(function () {
if (dropContent['mce-internal']) {
editor.execCommand('Delete');
}
setFocusedRange(editor, rng);
content = Utils.trimHtml(content);
if (!dropContent['text/html']) {
clipboard.pasteText(content);
} else {
clipboard.pasteHtml(content, internal);
}
});
示例5: function
const insert = function (editor: Editor, id: string) {
const selectedNode = editor.selection.getNode();
const isAnchor = selectedNode.tagName === 'A' && editor.dom.getAttrib(selectedNode, 'href') === '';
if (isAnchor) {
selectedNode.removeAttribute('name');
selectedNode.id = id;
editor.undoManager.add();
} else {
editor.focus();
editor.selection.collapse(true);
editor.execCommand('mceInsertContent', false, editor.dom.createHTML('a', {
id
}));
}
};
示例6: applyInlinePatterns
() => {
// create a cursor position that we can move to avoid the inline formats
editor.insertContent(Unicode.zeroWidth());
applyInlinePatterns(editor, inlineAreas);
blockArea.each((pattern) => applyBlockPattern(editor, pattern));
// find the spot before the cursor position
const range = editor.selection.getRng();
const block = editor.dom.getParent(range.startContainer, editor.dom.isBlock);
const spot = textBefore(range.startContainer, range.startOffset, block);
editor.execCommand('mceInsertNewLine');
// clean up the cursor position we used to preserve the format
spot.each((s) => {
if (s.node.data.charAt(s.offset - 1) === Unicode.zeroWidth()) {
s.node.deleteData(s.offset - 1, 1);
if (editor.dom.isEmpty(s.node.parentNode)) {
editor.dom.remove(s.node.parentNode);
}
}
});
}
示例7: switch
const handleMessage = (editor: Editor, api: Types.UrlDialog.UrlDialogInstanceApi, data: any) => {
switch (data.mceAction) {
case 'insertContent':
editor.insertContent(data.content);
break;
case 'setContent':
editor.setContent(data.content);
break;
case 'execCommand':
const ui = Type.isBoolean(data.ui) ? data.ui : false;
editor.execCommand(data.cmd, ui, data.value);
break;
case 'close':
api.close();
break;
case 'block':
api.block(data.message);
break;
case 'unblock':
api.unblock();
break;
}
};
示例8: actionSketch
const unlink = actionSketch('unlink', 'link', function () {
editor.execCommand('unlink', null, false);
});
示例9:
onAction: () => editor.execCommand('mceTogglePlainTextPaste'),
示例10:
onAction: () => editor.execCommand(alignNoneToolbarButton.cmd),