コード例 #1
0
ファイル: TabContext.ts プロジェクト: abstask/tinymce
const getNewRowCursorPosition = function (editor, table) {
  const rows = SelectorFilter.descendants(table, 'tr');
  return Arr.last(rows).bind(function (last) {
    return SelectorFind.descendant(last, 'td,th').map(function (first) {
      return getCellFirstCursorPosition(editor, first);
    });
  });
};
コード例 #2
0
ファイル: ComposeList.ts プロジェクト: mdgbayly/tinymce
const createJoinedSections = (scope: Document, length: number, listType: ListType): Section[] => {
  const sections: Section[] = [];
  for (let i = 0; i < length; i++) {
    const newSection = createSection(scope, listType);
    Arr.last(sections).each((lastSection) => joinSections(lastSection, newSection));
    sections.push(newSection);
  }
  return sections;
};
コード例 #3
0
ファイル: ComposeList.ts プロジェクト: danielpunkass/tinymce
const populateSegments = (segments: Segment[], entry: Entry): void => {
  for (let i = 0; i < segments.length - 1; i++) {
    Css.set(segments[i].item, 'list-style-type', 'none');
  }
  Arr.last(segments).each((segment) => {
    Attr.setAll(segment.list, entry.listAttributes);
    Attr.setAll(segment.item, entry.itemAttributes);
    InsertAll.append(segment.item, entry.content);
  });
};
コード例 #4
0
ファイル: ComposeList.ts プロジェクト: mdgbayly/tinymce
const writeDeep = (scope: Document, outline: Section[], entry: Entry): Section[] => {
  const newSections = createJoinedSections(scope, entry.depth - outline.length, entry.listType);
  populateSections(newSections, entry);

  Options.liftN([
    Arr.last(outline),
    Arr.head(newSections)
  ], joinSections);
  return outline.concat(newSections);
};
コード例 #5
0
ファイル: ComposeList.ts プロジェクト: mdgbayly/tinymce
const writeShallow = (scope: Document, outline: Section[], entry: Entry): Section[] => {
  const newOutline = outline.slice(0, entry.depth);

  Arr.last(newOutline).each((section) => {
    setItem(section, createItem(scope, entry.itemAttributes, entry.content));
    normalizeSection(section, entry);
  });

  return newOutline;
};
コード例 #6
0
ファイル: ComposeList.ts プロジェクト: danielpunkass/tinymce
const writeShallow = (scope: Document, cast: Segment[], entry: Entry): Segment[] => {
  const newCast = cast.slice(0, entry.depth);

  Arr.last(newCast).each((segment) => {
    const item = createItem(scope, entry.itemAttributes, entry.content);
    appendItem(segment, item);
    normalizeSegment(segment, entry);
  });

  return newCast;
};
コード例 #7
0
ファイル: ContextUi.ts プロジェクト: tinymce/tinymce
 AlloyEvents.run<BackwardSlideEvent>(backSlideEvent, (comp, se) => {
   Arr.last(stack.get()).each((last) => {
     stack.set(stack.get().slice(0, stack.get().length - 1));
     AlloyTriggers.emitWith(comp, changeSlideEvent, {
       // Because we are using premade, we should have access to the same element
       // to give focus (although it isn't working)
       contents: GuiFactory.premade(last.bar),
       focus: last.focus
     });
   });
 }),
コード例 #8
0
ファイル: CefNavigation.ts プロジェクト: tinymce/tinymce
 return () => {
   const from = forward ? CaretPosition.fromRangeEnd(editor.selection.getRng()) : CaretPosition.fromRangeStart(editor.selection.getRng());
   const result = forward ? getPositionsUntilNextLine(editor.getBody(), from) : getPositionsUntilPreviousLine(editor.getBody(), from);
   const to = forward ? Arr.last(result.positions) : Arr.head(result.positions);
   return to.filter(isCefPosition(forward)).fold(
     Fun.constant(false),
     (pos) => {
       editor.selection.setRng(pos.toRange());
       return true;
     }
   );
 };
コード例 #9
0
ファイル: ContextUi.ts プロジェクト: tinymce/tinymce
        onEscape: (comp) => {

          return Arr.last(stack.get()).fold(
            () => {
              // Escape just focuses the content. It no longer closes the toolbar.
              return spec.onEscape();
            },
            (_) => {
              AlloyTriggers.emit(comp, backSlideEvent);
              return Option.some(true);
            }
          );
        }
コード例 #10
0
ファイル: SilverContextMenu.ts プロジェクト: tinymce/tinymce
const addContextMenuGroup = (xs: Array<MenuItem>, groupItems: Array<MenuItem>) => {
  // Skip if there are no items
  if (groupItems.length === 0) {
    return xs;
  }

  // Only add a separator at the beginning if the last item isn't a separator
  const lastMenuItem = Arr.last(xs).filter((item) => !isSeparator(item));
  const before = lastMenuItem.fold(
    () => [],
    (_) => [ separator ]
  );
  return xs.concat(before).concat(groupItems).concat([ separator ]);
};