當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript DOMUtils.DOM類代碼示例

本文整理匯總了TypeScript中tinymce/core/dom/DOMUtils.DOM的典型用法代碼示例。如果您正苦於以下問題:TypeScript DOM類的具體用法?TypeScript DOM怎麽用?TypeScript DOM使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了DOM類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: function

const transposeUiContainer = function (element, pos) {
  if (element && DOMUtils.DOM.getStyle(element, 'position', true) !== 'static') {
    const containerPos = DOMUtils.DOM.getPos(element);
    const dx = containerPos.x - element.scrollLeft;
    const dy = containerPos.y - element.scrollTop;
    return transpose(pos, -dx, -dy);
  } else {
    return transpose(pos, 0, 0);
  }
};
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:10,代碼來源:Coords.ts

示例2: function

 suite.test('isUIElement on valid element', function (editor) {
   const uiElm1 = DOMUtils.DOM.create('div', { class: 'mce-abc' }, null);
   const uiElm2 = DOMUtils.DOM.create('div', { class: 'mcex-abc' }, null);
   const noUiElm = DOMUtils.DOM.create('div', { class: 'mcey-abc' }, null);
   editor.settings.custom_ui_selector = '.mcex-abc';
   LegacyUnit.equal(FocusController.isUIElement(editor, uiElm1), true, 'Should be true since mce- is a ui prefix');
   LegacyUnit.equal(FocusController.isUIElement(editor, uiElm2), true, 'Should be true since mcex- is a ui prefix');
   LegacyUnit.equal(FocusController.isUIElement(editor, noUiElm), false, 'Should be true since mcey- is not a ui prefix');
   delete editor.settings.custom_ui_selector;
 });
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:10,代碼來源:FocusControllerTest.ts

示例3: function

    Tools.each(invalidNames.split(' '), function (invalidName) {
      const elm = DOMUtils.DOM.add(document.body, invalidName, { class: 'targetEditor' }, null);

      EditorManager.init({
        selector: invalidName + '.targetEditor',
        skin_url: '/project/js/tinymce/skins/lightgray',
        inline: true
      });

      LegacyUnit.strictEqual(EditorManager.get().length, 0, 'Should not have created an editor');
      DOMUtils.DOM.remove(elm);
    });
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:12,代碼來源:EditorManagerTest.ts

示例4: function

const getUiContainerDelta = function () {
  const uiContainer = Env.container;
  if (uiContainer && DOMUtils.DOM.getStyle(uiContainer, 'position', true) !== 'static') {
    const containerPos = DOMUtils.DOM.getPos(uiContainer);
    const dx = uiContainer.scrollLeft - containerPos.x;
    const dy = uiContainer.scrollTop - containerPos.y;
    return Option.some({
      x: dx,
      y: dy
    });
  } else {
    return Option.none();
  }
};
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:14,代碼來源:UiContainer.ts

示例5: function

  const showForm = function (editor, id) {
    if (panel) {
      panel.items().hide();

      if (!showToolbar(panel, id)) {
        hide();
        return;
      }

      let contentAreaRect, panelRect, result, userConstainHandler;

      showPanel(panel);
      panel.items().hide();
      showToolbar(panel, id);

      userConstainHandler = Settings.getPositionHandler(editor);
      contentAreaRect = Measure.getContentAreaRect(editor);
      panelRect = DOMUtils.DOM.getRect(panel.getEl());

      result = Layout.calc(currentRect, contentAreaRect, panelRect);

      if (result) {
        panelRect = result.rect;
        movePanelTo(panel, Layout.userConstrain(userConstainHandler, currentRect, contentAreaRect, panelRect));
        togglePositionClass(panel, result.position);
      }
    }
  };
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:28,代碼來源:Panel.ts

示例6: function

export default function () {
  const domElm = DOMUtils.DOM.create('div', {
    style: 'position: absolute; right: 10px; top: 10px;'
  });

  const attach = function (preventDuplicates?) {
    if (preventDuplicates && domElm.parentNode === document.body) {
      detach();
    }
    document.body.appendChild(domElm);
  };

  const detach = function () {
    DOMUtils.DOM.remove(domElm);
  };

  const update = function (html) {
    DOMUtils.DOM.setHTML(domElm, html);
  };

  const get = function () {
    return domElm;
  };

  return {
    attach,
    update,
    detach,
    get
  };
}
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:31,代碼來源:ViewBlock.ts

示例7: function

const save = function (editor) {
  let formObj;

  formObj = DOMUtils.DOM.getParent(editor.id, 'form');

  if (Settings.enableWhenDirty(editor) && !editor.isDirty()) {
    return;
  }

  editor.save();

  // Use callback instead
  if (Settings.hasOnSaveCallback(editor)) {
    editor.execCallback('save_onsavecallback', editor);
    editor.nodeChanged();
    return;
  }

  if (formObj) {
    editor.setDirty(false);

    if (!formObj.onsubmit || formObj.onsubmit()) {
      if (typeof formObj.submit === 'function') {
        formObj.submit();
      } else {
        displayErrorMessage(editor, 'Error: Form submit field collision.');
      }
    }

    editor.nodeChanged();
  } else {
    displayErrorMessage(editor, 'Error: No form element found.');
  }
};
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:34,代碼來源:Actions.ts

示例8: 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 = 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:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:26,代碼來源:OpenUrl.ts

示例9: function

const toAbsolute = function (rect) {
  const vp = DOMUtils.DOM.getViewPort();

  return {
    x: rect.x + vp.x,
    y: rect.y + vp.y,
    w: rect.w,
    h: rect.h
  };
};
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:10,代碼來源:Measure.ts


注:本文中的tinymce/core/dom/DOMUtils.DOM類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。