本文整理匯總了TypeScript中@ephox/sugar.Attr.setAll方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Attr.setAll方法的具體用法?TypeScript Attr.setAll怎麽用?TypeScript Attr.setAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ephox/sugar.Attr
的用法示例。
在下文中一共展示了Attr.setAll方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
const createIframeElement = function (id: string, title: TranslatedString, height: number, customAttrs: {}) {
const iframe = Element.fromTag('iframe');
Attr.setAll(iframe, customAttrs);
Attr.setAll(iframe, {
id: id + '_ifr',
frameBorder: '0',
allowTransparency: 'true',
title
});
Class.add(iframe, 'tox-edit-area__iframe');
return iframe;
};
示例2: function
}, function (link) {
const text = getTextToApply(link, url, info);
Attr.setAll(link, attrs);
text.each(function (newText) {
TextContent.set(link, newText);
});
});
示例3: 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);
};
示例4: function
const createIframeElement = function (id, title, height, customAttrs) {
const iframe = Element.fromTag('iframe');
Attr.setAll(iframe, customAttrs);
Attr.setAll(iframe, {
id: id + '_ifr',
frameBorder: '0',
allowTransparency: 'true',
title
});
Css.setAll(iframe, {
width: '100%',
height: normalizeHeight(height),
display: 'block' // Important for Gecko to render the iframe correctly
});
return iframe;
};
示例5: decorate
const makeAnnotation = (eDoc: Document, { uid = Id.generate('mce-annotation'), ...data }, annotationName: string, decorate: Decorator): Element => {
const master = Element.fromTag('span', eDoc);
Class.add(master, Markings.annotation());
Attr.set(master, `${Markings.dataAnnotationId()}`, uid);
Attr.set(master, `${Markings.dataAnnotation()}`, annotationName);
const { attributes = { }, classes = [ ] } = decorate(uid, data);
Attr.setAll(master, attributes);
Classes.add(master, classes);
return master;
};
示例6: 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);
};
示例7: function
const createIframeElement = function (id, title, height, customAttrs) {
const iframe = Element.fromTag('iframe');
Attr.setAll(iframe, customAttrs);
// Workaround WebKit regression in which findFrameNamed: no longer works to find the TinyMCE editor frame by it's ID,
// because the frame's name is only considered to be set by the name attribute. See: https://bugs.webkit.org/show_bug.cgi?id=187937
// Need to define "name" below to accommodate it.
Attr.setAll(iframe, {
id: id + '_ifr',
name: id + '_ifr',
frameBorder: '0',
allowTransparency: 'true',
title
});
Css.setAll(iframe, {
width: '100%',
height: normalizeHeight(height),
display: 'block' // Important for Gecko to render the iframe correctly
});
return iframe;
};
示例8: function
const createCaretContainer = function (fill) {
const caretContainer = Element.fromTag('span');
Attr.setAll(caretContainer, {
// style: 'color:red',
'id': CARET_ID,
'data-mce-bogus': '1',
'data-mce-type': 'format-caret'
});
if (fill) {
Insert.append(caretContainer, Element.fromText(ZWSP));
}
return caretContainer;
};
示例9: moveToRange
editor.undoManager.transact(() => {
const element = SugarElement.fromTag(forcedRootBlock);
Attr.setAll(element, Settings.getForcedRootBlockAttrs(editor));
Insert.append(element, SugarElement.fromTag('br'));
if (down) {
Insert.after(SugarElement.fromDom(table), element);
} else {
Insert.before(SugarElement.fromDom(table), element);
}
const rng = editor.dom.createRng();
rng.setStart(element.dom(), 0);
rng.setEnd(element.dom(), 0);
moveToRange(editor, rng);
});
示例10: function
const onload = DomEvent.bind(iframe, 'load', function () {
const head = Element.fromDom(iframe.dom().contentWindow.document.head);
const body = Element.fromDom(iframe.dom().contentWindow.document.body);
Attachment.attachSystem(body, realm.system());
Css.set(body, 'margin', '0px');
const css = Element.fromTag('link');
Attr.setAll(css, {
href: '/project/tinymce/js/tinymce/skins/ui/oxide/skin.mobile.min.css',
rel: 'Stylesheet',
type: 'text/css'
});
Insert.append(head, css);
onload.unbind();
const editor = Element.fromTag('iframe');
Attr.set(editor, 'src', '/project/tinymce/src/themes/mobile/test/html/editor.html');
Replacing.append(
realm.system().getByDom(Element.fromDom(
realm.element().dom().querySelector('.tinymce-mobile-editor-socket'))
).getOrDie(),
GuiFactory.external({
element: editor
})
);
realm.init({
editor: {
getFrame () {
return editor;
},
onDomChanged () {
return { unbind: Fun.noop };
}
},
container: realm.element(),
socket: Element.fromDom(realm.element().dom().querySelector('.tinymce-mobile-editor-socket')),
toolstrip: Element.fromDom(realm.element().dom().querySelector('.tinymce-mobile-toolstrip')),
toolbar: Element.fromDom(realm.element().dom().querySelector('.tinymce-mobile-toolbar')),
alloy: realm.system(),
dropup: realm.dropup()
});
});