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


TypeScript DOMUtils.DOM类代码示例

本文整理汇总了TypeScript中tinymce/core/api/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:abstask,项目名称:tinymce,代码行数: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:tinymce,项目名称:tinymce,代码行数: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:abstask,项目名称:tinymce,代码行数: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 = containerPos.x - uiContainer.scrollLeft;
    const dy = containerPos.y - uiContainer.scrollTop;
    return Option.some({
      x: dx,
      y: dy
    });
  } else {
    return Option.none();
  }
};
开发者ID:,项目名称:,代码行数:14,代码来源:

示例5: function

const getUiContainerDelta = function (ctrl) {
  const uiContainer = getUiContainer(ctrl);
  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:danielpunkass,项目名称:tinymce,代码行数:14,代码来源:UiContainer.ts

示例6: 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:abstask,项目名称:tinymce,代码行数:34,代码来源:Actions.ts

示例7: function

export default function () {
  const domElm: HTMLElement = 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:danielpunkass,项目名称:tinymce,代码行数:31,代码来源:ViewBlock.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: 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

示例9: function

  const showForm = function (editor: 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:danielpunkass,项目名称:tinymce,代码行数:28,代码来源:Panel.ts


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