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


TypeScript NodeType.isBr函數代碼示例

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


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

示例1: if

const getBreakType = (scope: HTMLElement, direction: HDirection, currentPos: CaretPosition, nextPos: CaretPosition): BreakType => {
  if (NodeType.isBr(nextPos.getNode(direction === HDirection.Forwards))) {
    return BreakType.Br;
  } else if (isInSameBlock(currentPos, nextPos) === false) {
    return BreakType.Block;
  } else {
    return BreakType.Wrap;
  }
};
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:9,代碼來源:LineReader.ts

示例2: getPositionsUntil

const isAtTableCellLine = (getPositionsUntil, scope: HTMLElement, pos: CaretPosition) => {
  const lineInfo = getPositionsUntil(scope, pos);

  // Since we can't determine if the caret is on the above or below line in a word wrap break we asume it's always
  // on the below/above line based on direction. This will make the caret jump one line if you are at the end of the last
  // line and moving down or at the beginning of the second line moving up.
  if (startsWithWrapBreak(lineInfo) || (!NodeType.isBr(pos.getNode()) && startsWithBrBreak(lineInfo))) {
    return !hasNextBreak(getPositionsUntil, scope, lineInfo);
  } else {
    return lineInfo.breakAt.isNone();
  }
};
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:12,代碼來源:TableNavigation.ts

示例3: CaretWalker

const getPositionsUntil = (predicate: CheckerPredicate, direction: HDirection, scope: HTMLElement, start: CaretPosition): LineInfo => {
  const caretWalker = CaretWalker(scope);
  let currentPos = start, nextPos: CaretPosition;
  const positions: CaretPosition[] = [];

  while (currentPos) {
    nextPos = walk(direction, caretWalker, currentPos);

    if (!nextPos) {
      break;
    }

    if (NodeType.isBr(nextPos.getNode(false))) {
      if (direction === HDirection.Forwards) {
        return { positions: flip(direction, positions).concat([nextPos]), breakType: BreakType.Br, breakAt: Option.some(nextPos) };
      } else {
        return { positions: flip(direction, positions), breakType: BreakType.Br, breakAt: Option.some(nextPos) };
      }
    }

    if (!nextPos.isVisible()) {
      currentPos = nextPos;
      continue;
    }

    if (predicate(currentPos, nextPos)) {
      const breakType = getBreakType(scope, direction, currentPos, nextPos);
      return { positions: flip(direction, positions), breakType, breakAt: Option.some(nextPos) };
    }

    positions.push(nextPos);
    currentPos = nextPos;
  }

  return { positions: flip(direction, positions), breakType: BreakType.Eol, breakAt: Option.none() };
};
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:36,代碼來源:LineReader.ts

示例4: function

 suite.test('isBr', function () {
   LegacyUnit.strictEqual(NodeType.isBr(null), false);
   LegacyUnit.strictEqual(NodeType.isBr(document.createTextNode('x')), false);
   LegacyUnit.strictEqual(NodeType.isBr(document.createElement('br')), true);
   LegacyUnit.strictEqual(NodeType.isBr(document.createComment('x')), false);
 });
開發者ID:abstask,項目名稱:tinymce,代碼行數:6,代碼來源:NodeTypeTest.ts


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