本文整理汇总了TypeScript中tinymce/core/api/Editor.insertContent函数的典型用法代码示例。如果您正苦于以下问题:TypeScript insertContent函数的具体用法?TypeScript insertContent怎么用?TypeScript insertContent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了insertContent函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const handleInsert = function (editor: Editor, html) {
const beforeObjects = editor.dom.select('img[data-mce-object]');
editor.insertContent(html);
selectPlaceholder(editor, beforeObjects);
editor.nodeChanged();
};
示例2: function
const pasteHtml = function (editor: Editor, html: string) {
editor.insertContent(removeMeta(editor, html), {
merge: Settings.shouldMergeFormats(editor),
paste: true
});
return true;
};
示例3: function
const insertBlob = function (editor: Editor, base64: string, blob: Blob) {
let blobCache, blobInfo;
blobCache = editor.editorUpload.blobCache;
blobInfo = blobCache.create(Id.generate('mceu'), blob, base64);
blobCache.add(blobInfo);
editor.insertContent(editor.dom.createHTML('img', { src: blobInfo.blobUri() }));
};
示例4: getInsertedElement
editor.undoManager.transact(function () {
let tableElm, cellElm;
editor.insertContent(createTableHtml(cols, rows));
tableElm = getInsertedElement(editor);
tableElm.removeAttribute('data-mce-id');
cellElm = editor.dom.select('td,th', tableElm);
editor.selection.setCursorLocation(cellElm[0], 0);
});
示例5: 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);
}
}
});
}
示例6: 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;
}
};
示例7: getDefaultStyles
const insert = (editor: Editor, columns: number, rows: number): HTMLElement => {
const defaultStyles = getDefaultStyles(editor);
const options: TableRender.RenderOptions = {
styles: defaultStyles,
attributes: getDefaultAttributes(editor),
percentages: isPercentage(defaultStyles.width) && !isPixelsForced(editor)
};
const table = TableRender.render(rows, columns, 0, 0, options);
Attr.set(table, 'data-mce-id', '__mce');
const html = Html.getOuter(table);
editor.insertContent(html);
return SelectorFind.descendant(Util.getBody(editor), 'table[data-mce-id="__mce"]').map((table) => {
if (isPixelsForced(editor)) {
Css.set(table, 'width', Css.get(table, 'width'));
}
Attr.remove(table, 'data-mce-id');
fireEvents(editor, table);
selectFirstCellInTable(editor, table);
return table.dom();
}).getOr(null);
};
示例8: function
const insertEmoticon = function (editor: Editor, ch: string): void {
editor.insertContent(ch);
};
示例9:
onAction: (autocompleteApi, rng, value) => {
ed.selection.setRng(rng);
ed.insertContent('=' + value);
autocompleteApi.hide();
}
示例10:
return node.fold(() => {
editor.insertContent('<pre id="__new" class="language-' + language + '">' + code + '</pre>');
editor.selection.select(editor.$('#__new').removeAttr('id')[0]);
}, (n) => {