本文整理汇总了TypeScript中tinymce/core/api/Editor.Editor.insertContent方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Editor.insertContent方法的具体用法?TypeScript Editor.insertContent怎么用?TypeScript Editor.insertContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tinymce/core/api/Editor.Editor
的用法示例。
在下文中一共展示了Editor.insertContent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const pasteHtml = function (editor: Editor, html: string) {
editor.insertContent(html, {
merge: Settings.shouldMergeFormats(editor),
paste: true
});
return true;
};
示例2:
const applyReplacement = (editor: Editor, target: Text, match: ReplacementMatch) => {
target.deleteData(match.startOffset, match.pattern.start.length);
editor.insertContent(match.pattern.replacement);
Option.from(target.nextSibling).filter(isText).each((nextSibling: Text) => {
nextSibling.insertData(0, target.data);
editor.dom.remove(target);
});
};
示例3: function
const insertBlob = function (editor: Editor, base64: string, blob: Blob) {
let blobCache, blobInfo;
blobCache = editor.editorUpload.blobCache;
blobInfo = blobCache.create(Uuid.uuid('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: function
Tools.each(suggestions, function (suggestion) {
items.push({
text: suggestion,
onclick () {
editor.insertContent(editor.dom.encode(suggestion));
editor.dom.remove(spans);
Actions.checkIfFinished(editor, startedState, textMatcherState);
}
});
});
示例6: 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);
};