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


TypeScript Element.default方法代碼示例

本文整理匯總了TypeScript中@ephox/dom-globals.Element.default方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Element.default方法的具體用法?TypeScript Element.default怎麽用?TypeScript Element.default使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@ephox/dom-globals.Element的用法示例。


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

示例1: getStart

const getSelectedBlocks = (dom: DOMUtils, rng: Range, startElm?: Element, endElm?: Element): Element[] => {
  let node, root;
  const selectedBlocks = [];

  root = dom.getRoot();
  startElm = dom.getParent(startElm || getStart(root, rng, rng.collapsed), dom.isBlock) as Element;
  endElm = dom.getParent(endElm || getEnd(root, rng, rng.collapsed), dom.isBlock) as Element;

  if (startElm && startElm !== root) {
    selectedBlocks.push(startElm);
  }

  if (startElm && endElm && startElm !== endElm) {
    node = startElm;

    const walker = new TreeWalker(startElm, root);
    while ((node = walker.next()) && node !== endElm) {
      if (dom.isBlock(node)) {
        selectedBlocks.push(node);
      }
    }
  }

  if (endElm && startElm !== endElm && endElm !== root) {
    selectedBlocks.push(endElm);
  }

  return selectedBlocks;
};
開發者ID:tinymce,項目名稱:tinymce,代碼行數:29,代碼來源:ElementSelection.ts

示例2: function

const create = (editor: Editor, lastRngCell, pasteBinDefaultContent: string) => {
  const dom = editor.dom, body = editor.getBody();
  let pasteBinElm;

  lastRngCell.set(editor.selection.getRng());

  // Create a pastebin
  pasteBinElm = editor.dom.add(getPasteBinParent(editor), 'div', {
    'id': 'mcepastebin',
    'class': 'mce-pastebin',
    'contentEditable': true,
    'data-mce-bogus': 'all',
    'style': 'position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0'
  }, pasteBinDefaultContent);

  // Move paste bin out of sight since the controlSelection rect gets displayed otherwise on IE and Gecko
  if (Env.ie || Env.gecko) {
    dom.setStyle(pasteBinElm, 'left', dom.getStyle(body, 'direction', true) === 'rtl' ? 0xFFFF : -0xFFFF);
  }

  // Prevent focus events from bubbeling fixed FocusManager issues
  dom.bind(pasteBinElm, 'beforedeactivate focusin focusout', function (e) {
    e.stopPropagation();
  });

  delegatePasteEvents(editor, pasteBinElm, pasteBinDefaultContent);

  pasteBinElm.focus();
  editor.selection.select(pasteBinElm, true);
};
開發者ID:tinymce,項目名稱:tinymce,代碼行數:30,代碼來源:PasteBin.ts

示例3: CaretWalker

const exitPreBlock = (editor, direction: HDirection, range: Range): void => {
  let pre, caretPos, newBlock;
  const caretWalker = CaretWalker(editor.getBody());
  const getNextVisualCaretPosition = Fun.curry(getVisualCaretPosition, caretWalker.next);
  const getPrevVisualCaretPosition = Fun.curry(getVisualCaretPosition, caretWalker.prev);

  if (range.collapsed && editor.settings.forced_root_block) {
    pre = editor.dom.getParent(range.startContainer, 'PRE');
    if (!pre) {
      return;
    }

    if (direction === 1) {
      caretPos = getNextVisualCaretPosition(CaretPosition.fromRangeStart(range));
    } else {
      caretPos = getPrevVisualCaretPosition(CaretPosition.fromRangeStart(range));
    }

    if (!caretPos) {
      newBlock = createTextBlock(editor);

      if (direction === 1) {
        editor.$(pre).after(newBlock);
      } else {
        editor.$(pre).before(newBlock);
      }

      editor.selection.select(newBlock, true);
      editor.selection.collapse();
    }
  }
};
開發者ID:mdgbayly,項目名稱:tinymce,代碼行數:32,代碼來源:CefNavigation.ts

示例4: function

    Delay.setEditorTimeout(self, function () {
      const focusedEditor = editorManager.focusedEditor;

      // Still the same editor the blur was outside any editor UI
      if (!isUIElement(self, getActiveElement()) && focusedEditor === self) {
        self.fire('blur', { focusedEditor: null });
        editorManager.focusedEditor = null;
      }
    });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:9,代碼來源:FocusController.ts

示例5:

const insertBlock = (blockName: string, node: Node, before: boolean): Node => {
  let doc, blockNode, parentNode;

  doc = node.ownerDocument;
  blockNode = doc.createElement(blockName);
  blockNode.setAttribute('data-mce-caret', before ? 'before' : 'after');
  blockNode.setAttribute('data-mce-bogus', 'all');
  blockNode.appendChild(createBogusBr());
  parentNode = node.parentNode;

  if (!before) {
    if (node.nextSibling) {
      parentNode.insertBefore(blockNode, node.nextSibling);
    } else {
      parentNode.appendChild(blockNode);
    }
  } else {
    parentNode.insertBefore(blockNode, node);
  }

  return blockNode;
};
開發者ID:mdgbayly,項目名稱:tinymce,代碼行數:22,代碼來源:CaretContainer.ts

示例6: getPasteBinParent

const isExternalPasteBin = (editor: Editor) => getPasteBinParent(editor) !== editor.getBody();
開發者ID:tinymce,項目名稱:tinymce,代碼行數:1,代碼來源:PasteBin.ts

示例7: findSibling

const findAdjacentContentEditableFalseElm = function (rng: Range) {
  return findSibling(rng.startContainer, rng.startOffset) || findSibling(rng.endContainer, rng.endOffset);
};
開發者ID:tinymce,項目名稱:tinymce,代碼行數:3,代碼來源:GetBookmark.ts


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