本文整理汇总了TypeScript中@ephox/dom-globals.document类的典型用法代码示例。如果您正苦于以下问题:TypeScript document类的具体用法?TypeScript document怎么用?TypeScript document使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了document类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
export default function () {
const textarea = document.createElement('textarea');
textarea.innerHTML = '<p>Bolt</p>';
textarea.classList.add('tinymce');
document.querySelector('#ephox-ui').appendChild(textarea);
tinymce.init({
// imagetools_cors_hosts: ["moxiecode.cachefly.net"],
// imagetools_proxy: "proxy.php",
// imagetools_api_key: '123',
// images_upload_url: 'postAcceptor.php',
// images_upload_base_path: 'base/path',
// images_upload_credentials: true,
skin_url: '../../../../js/tinymce/skins/ui/oxide',
setup (ed) {
ed.addButton('demoButton', {
type: 'button',
text: 'Demo',
onclick () {
ed.insertContent('Hello world!');
}
});
},
selector: 'textarea.tinymce',
toolbar1: 'demoButton bold italic',
menubar: false
});
}
示例2: function
const open = function (url) {
// Chrome and Webkit has implemented noopener and works correctly with/without popup blocker
// Firefox has it implemented noopener but when the popup blocker is activated it doesn't work
// Edge has only implemented noreferrer and it seems to remove opener as well
// Older IE versions pre IE 11 falls back to a window.open approach
if (!Env.ie || Env.ie > 10) {
const link = document.createElement('a');
link.target = '_blank';
link.href = url;
link.rel = 'noreferrer noopener';
const evt = document.createEvent('MouseEvents');
evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
appendClickRemove(link, evt);
} else {
const win: any = window.open('', '_blank');
if (win) {
win.opener = null;
const doc = win.document;
doc.open();
doc.write('<meta http-equiv="refresh" content="0; url=' + DOMUtils.DOM.encode(url) + '">');
doc.close();
}
}
};
示例3: function
suite.test('isCaretContainerInline', function () {
LegacyUnit.equal(CaretContainer.isCaretContainerInline(document.createTextNode('text')), false);
LegacyUnit.equal(CaretContainer.isCaretContainerInline(DomQuery('<span></span>')[0]), false);
LegacyUnit.equal(CaretContainer.isCaretContainerInline(DomQuery('<span data-mce-caret="1"></span>')[0]), false);
LegacyUnit.equal(CaretContainer.isCaretContainerInline(DomQuery('<span data-mce-caret="1">a</span>')[0].firstChild), false);
LegacyUnit.equal(CaretContainer.isCaretContainerInline(document.createTextNode(Zwsp.ZWSP)), true);
});
示例4: function
suite.test('create deep element index', function () {
setupHtml('<p><span>a</span><span><b id="a"></b><b id="b"></b><b id="c"></b></span></p>');
LegacyUnit.equal(CaretBookmark.create(getRoot(), CaretPosition.before(document.getElementById('a'))), 'p[0]/span[1]/b[0],before');
LegacyUnit.equal(CaretBookmark.create(getRoot(), CaretPosition.before(document.getElementById('b'))), 'p[0]/span[1]/b[1],before');
LegacyUnit.equal(CaretBookmark.create(getRoot(), CaretPosition.before(document.getElementById('c'))), 'p[0]/span[1]/b[2],before');
LegacyUnit.equal(CaretBookmark.create(getRoot(), CaretPosition.after(document.getElementById('c'))), 'p[0]/span[1]/b[2],after');
});
示例5:
suite.test('should not throw error when passed in element without parent', () => {
const rootDiv = document.createElement('div');
const element = document.createElement('p');
const actual = FontInfo.getFontSize(rootDiv, element);
LegacyUnit.equal('string', typeof actual, 'should return always string');
});
示例6: function
suite.test('hasPropValue', function () {
const hasTabIndex3 = NodeType.hasPropValue('tabIndex', 3);
LegacyUnit.strictEqual(hasTabIndex3(null), false);
LegacyUnit.strictEqual(hasTabIndex3($('<div tabIndex="3"></div>')[0]), true);
LegacyUnit.strictEqual(hasTabIndex3(document.createElement('div')), false);
LegacyUnit.strictEqual(hasTabIndex3(document.createElement('b')), false);
});
示例7: function
], function (notification) {
const btn = document.createElement('button');
btn.innerHTML = notification.title;
btn.onclick = function () {
notification.action(notification.value);
};
document.querySelector('#ephox-ui').appendChild(btn);
});
示例8: function
Arr.each(commands, function (cmd) {
const btn = document.createElement('button');
btn.innerHTML = cmd.command;
btn.onclick = function () {
tinymce.activeEditor.execCommand(cmd.command, false, cmd.value);
};
document.querySelector('#ephox-ui').appendChild(btn);
});
示例9: function
const createRng = function (text, startOffset, endOffset) {
const textNode = document.createTextNode(text);
const rng = document.createRange();
rng.setStart(textNode, startOffset);
rng.setEnd(textNode, endOffset);
return rng;
};