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


TypeScript sugar.Node類代碼示例

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


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

示例1:

 return table.map((table) => {
   if (Node.name(cellOrCaption) === 'caption') {
     return TableTargets.notCell(cellOrCaption);
   } else {
     return TableTargets.forMenu(selections, table, cellOrCaption);
   }
 });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:7,代碼來源:SelectionTargets.ts

示例2: context

  const processElement = (elem) => {
    const ctx = context(editor, elem, 'span', Node.name(elem));

    switch (ctx) {
      case ChildContext.InvalidChild: {
        finishWrapper();
        const children = Traverse.children(elem);
        processElements(children);
        finishWrapper();
        break;
      }

      case ChildContext.Valid: {
        const w = getOrOpenWrapper();
        Insert.wrap(elem, w);
        break;
      }

      // INVESTIGATE: Are these sensible things to do?
      case ChildContext.Skipping:
      case ChildContext.Existing:
      case ChildContext.Caret: {
        // Do nothing.
      }
    }
  };
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:26,代碼來源:Wrapping.ts

示例3:

 return selectionTargets.targets().fold(() => '', (targets) => {
   // If clicking in a caption, then we shouldn't show the cell/row/column options
   if (Node.name(targets.element()) === 'caption') {
     return 'tableprops deletetable';
   } else {
     return 'cell row column | tableprops deletetable';
   }
 });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:8,代碼來源:MenuItems.ts

示例4: function

 function (child) {
   if (Node.name(child) === 'br') {
     return Traverse.prevSibling(child).map(function (sibling) {
       return [node].concat(getLastChildren(sibling));
     }).getOr([]);
   } else {
     return [node].concat(getLastChildren(child));
   }
 }
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:9,代碼來源:SelectionUtils.ts

示例5: if

 Chain.op((element) => {
   if (element.dom().type === 'checkbox') {
     Checked.set(element, value);
   } else if (Node.name(element) === 'select' && typeof value === 'number') {
     SelectTag.setSelected(element, value);
   } else {
     Value.set(element, value);
   }
 })
開發者ID:tinymce,項目名稱:tinymce,代碼行數:9,代碼來源:Helpers.ts

示例6: function

  Arr.each(nodeList, function (n) {
    const withSpans = Nodes.replaceWithSpans(Node.value(n));

    div = editor.dom.create('div', null, withSpans);
    while ((node = div.lastChild)) {
      editor.dom.insertAfter(node, n.dom());
    }

    editor.dom.remove(n.dom());
  });
開發者ID:abstask,項目名稱:tinymce,代碼行數:10,代碼來源:VisualChars.ts

示例7: function

  const captureInput = DomEvent.bind(page, 'keydown', function (evt) {
    // Think about killing the event.
    if (! Arr.contains([ 'input', 'textarea' ], Node.name(evt.target()))) {

      // FIX: Close the menus
      // closeMenus()

      toEditing();
    }
  });
開發者ID:abstask,項目名稱:tinymce,代碼行數:10,代碼來源:IosKeyboard.ts

示例8: cloneItemContent

 return Traverse.parent(li).map((list) => {
   return {
     depth,
     isSelected,
     content: cloneItemContent(li),
     itemAttributes: Attr.clone(li),
     listAttributes: Attr.clone(list),
     listType: Node.name(list) as ListType
   };
 });
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:10,代碼來源:Entry.ts

示例9: function

const clamp = function (offset, element) {
  const max = Node.isText(element) ? Text.get(element).length : Traverse.children(element).length + 1;

  if (offset > max) {
    return max;
  } else if (offset < 0) {
    return 0;
  }

  return offset;
};
開發者ID:mdgbayly,項目名稱:tinymce,代碼行數:11,代碼來源:SelectionBookmark.ts

示例10: function

const getRawOrComputed = function (isRoot, rawStart) {
  const optStart = Node.isElement(rawStart) ? Option.some(rawStart) : Traverse.parent(rawStart);
  return optStart.map(function (start) {
    const inline = PredicateFind.closest(start, (elem) => Css.getRaw(elem, 'font-size').isSome(), isRoot)
      .bind((elem) => Css.getRaw(elem, 'font-size'));

    return inline.getOrThunk(function () {
      return Css.get(start, 'font-size');
    });
  }).getOr('');
};
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:11,代碼來源:FontSizes.ts


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