本文整理汇总了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);
};