当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript dom-globals.document类代码示例

本文整理汇总了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
  });
}
开发者ID:tinymce,项目名称:tinymce,代码行数:31,代码来源:TinyMceDemo.ts

示例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();
    }
  }
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:26,代码来源:OpenUrl.ts

示例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);
 });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:7,代码来源:CaretContainerTest.ts

示例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');
 });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:7,代码来源:CaretBookmarkTest.ts

示例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');
  });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:8,代码来源:FontInfoTest.ts

示例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);
  });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:8,代码来源:NodeTypeTest.ts

示例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);
 });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:8,代码来源:NotificationDemo.ts

示例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);
 });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:8,代码来源:CommandsDemo.ts

示例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;
  };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:9,代码来源:FindInlinePatternTest.ts


注:本文中的@ephox/dom-globals.document类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。