本文整理匯總了TypeScript中@ephox/sugar.Insert.append方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Insert.append方法的具體用法?TypeScript Insert.append怎麽用?TypeScript Insert.append使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ephox/sugar.Insert
的用法示例。
在下文中一共展示了Insert.append方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
const appendStyle = function (editor: Editor, text: string) {
const head = Element.fromDom(editor.getDoc().head);
const tag = Element.fromTag('style');
Attr.set(tag, 'type', 'text/css');
Insert.append(tag, Element.fromText(text));
Insert.append(head, tag);
};
示例2: n
NamedChain.write('container', Chain.async((input, n, die) => {
const container = Element.fromTag('div');
Attr.set(container, 'id', 'test-container-div');
Html.set(container, containerHtml);
Insert.append(Body.body(), container);
n(container);
})),
示例3:
const insertElement = (root: Element, elm: Element, forward: boolean) => {
if (forward) {
Insert.append(root, elm);
} else {
Insert.prepend(root, elm);
}
};
示例4:
const createSection = (scope: Document, listType: ListType): Section => {
const section: Section = {
list: Element.fromTag(listType, scope),
item: Element.fromTag('li', scope)
};
Insert.append(section.list, section.item);
return section;
};
示例5:
const createSegment = (scope: Document, listType: ListType): Segment => {
const segment: Segment = {
list: Element.fromTag(listType, scope),
item: Element.fromTag('li', scope)
};
Insert.append(segment.list, segment.item);
return segment;
};
示例6: function
const createDomTable = function (table, rows) {
const tableElement = Replication.shallow(table.element());
const tableBody = Element.fromTag('tbody');
InsertAll.append(tableBody, rows);
Insert.append(tableElement, tableBody);
return tableElement;
};
示例7: next
return Step.stateful(function (value, next, die) {
const style = Element.fromTag('style');
const head = Element.fromDom(doc.dom().head);
Insert.append(head, style);
Html.set(style, styles.join('\n'));
next(Merger.deepMerge(value, {
style
}));
});
示例8: function
const paddEmptyBlock = function (elm) {
if (Empty.isEmpty(elm)) {
const br = Element.fromHtml('<br data-mce-bogus="1">');
Remove.empty(elm);
Insert.append(elm, br);
return Option.some(CaretPosition.before(br.dom()));
} else {
return Option.none();
}
};
示例9: rangeBefore
const insertBlock = (root: Element, forward: boolean, blockName: string, attrs: Record<string, string>) => {
const block = Element.fromTag(blockName);
const br = Element.fromTag('br');
Attr.setAll(block, attrs);
Insert.append(block, br);
insertElement(root, block, forward);
return rangeBefore(br);
};
示例10: function
const addStyles = function () {
const link = Element.fromTag('link');
Attr.setAll(link, {
rel: 'Stylesheet',
href: '/project/js/tinymce/skins/lightgray/skin.mobile.min.css',
type: 'text/css'
});
Class.add(link, styleClass);
const head = Element.fromDom(document.head);
Insert.append(head, link);
};