當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。