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


TypeScript Cell.set方法代码示例

本文整理汇总了TypeScript中@ephox/katamari.Cell.set方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Cell.set方法的具体用法?TypeScript Cell.set怎么用?TypeScript Cell.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@ephox/katamari.Cell的用法示例。


在下文中一共展示了Cell.set方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

    onSubmit: (api) => {
      const nuData = api.getData();

      const headHtml = Parser.dataToHtml(editor, Tools.extend(data, nuData), headState.get());

      headState.set(headHtml);

      api.close();
    }
开发者ID:tinymce,项目名称:tinymce,代码行数:9,代码来源:Dialog.ts

示例2: function

const safeRemoveCaretContainer = function (editor: Editor, caret: Cell<Text>) {
  if (editor.selection.isCollapsed() && editor.composing !== true && caret.get()) {
    const pos = CaretPosition.fromRangeStart(editor.selection.getRng());
    if (CaretPosition.isTextPosition(pos) && InlineUtils.isAtZwsp(pos) === false) {
      setCaretPosition(editor, CaretContainerRemove.removeAndReposition(caret.get(), pos));
      caret.set(null);
    }
  }
};
开发者ID:tinymce,项目名称:tinymce,代码行数:9,代码来源:BoundarySelection.ts

示例3: function

const markErrors = function (editor: Editor, startedState: Cell<boolean>, textMatcherState: Cell<DomTextMatcher>, lastSuggestionsState: Cell<LastSuggestion>, data: Data) {
  let suggestions, hasDictionarySupport;

  if (typeof data !== 'string' && data.words) {
    hasDictionarySupport = !!data.dictionary;
    suggestions = data.words;
  } else {
    // Fallback to old format
    suggestions = data;
  }

  editor.setProgressState(false);

  if (isEmpty(suggestions)) {
    const message = editor.translate('No misspellings found.');
    editor.notificationManager.open({ text: message, type: 'info' });
    startedState.set(false);
    return;
  }

  lastSuggestionsState.set({
    suggestions,
    hasDictionarySupport
  });

  const bookmark = editor.selection.getBookmark();

  getTextMatcher(editor, textMatcherState).find(Settings.getSpellcheckerWordcharPattern(editor)).filter(function (match) {
    return !!suggestions[match.text];
  }).wrap(function (match) {
    return editor.dom.create('span', {
      'class': 'mce-spellchecker-word',
      'data-mce-bogus': 1,
      'data-mce-word': match.text
    });
  });

  editor.selection.moveToBookmark(bookmark);

  startedState.set(true);
  Events.fireSpellcheckStart(editor);
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:42,代码来源:Actions.ts

示例4: storeDraft

const startStoreDraft = (editor: Editor, started: Cell<boolean>) => {
  const interval = Settings.getAutoSaveInterval(editor);

  if (!started.get()) {
    Delay.setInterval(() => {
      if (!editor.removed) {
        storeDraft(editor);
      }
    }, interval);

    started.set(true);
  }
};
开发者ID:tinymce,项目名称:tinymce,代码行数:13,代码来源:Storage.ts

示例5:

const addListeners = (registeredFormatListeners: Cell<RegisteredFormats>, formats: string, callback: FormatChangeCallback, similar: boolean) => {
  const formatChangeItems = registeredFormatListeners.get();

  Arr.each(formats.split(','), (format) => {
    if (!formatChangeItems[format]) {
      formatChangeItems[format] = { similar, callbacks: [] };
    }

    formatChangeItems[format].callbacks.push(callback);
  });

  registeredFormatListeners.set(formatChangeItems);
};
开发者ID:tinymce,项目名称:tinymce,代码行数:13,代码来源:FormatChanged.ts

示例6: function

        const listener = function (state, name, obj) {
          // NOTE: These failures won't stop the tests, but they will stop it before it updates
          // the changes in changes.set
          if (state === false) {
            Assertions.assertEq('Argument count must be "2" (state, name) if state is false', 2, arguments.length);
          } else {
            const { uid, nodes } = obj;
            // In this test, gamma markers span multiple nodes
            if (name === 'gamma') { Assertions.assertEq('Gamma annotations must have 2 nodes', 2, nodes.length); }
            assertMarker(ed, { uid, name }, nodes);
          }

          changes.set(
            changes.get().concat([
              { uid: state ? obj.uid : null, name, state }
            ])
          );
        };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:18,代码来源:AnnotationChangedTest.ts

示例7: callback

const updateAndFireChangeCallbacks = (editor: Editor, elm: Element, currentFormats: Cell<FormatCallbacks>, formatChangeData: RegisteredFormats) => {
  const formatsList = Obj.keys(currentFormats.get());
  const newFormats: FormatCallbacks = { };
  const matchedFormats: FormatCallbacks = { };

  // Ignore bogus nodes like the <a> tag created by moveStart()
  const parents = Arr.filter(FormatUtils.getParents(editor.dom, elm), (node) => {
    return node.nodeType === 1 && !node.getAttribute('data-mce-bogus');
  });

  // Check for new formats
  Obj.each(formatChangeData, (data: FormatData, format: string) => {
    Tools.each(parents, (node: Node) => {
      if (editor.formatter.matchNode(node, format, {}, data.similar)) {
        if (formatsList.indexOf(format) === -1) {
          // Execute callbacks
          Arr.each(data.callbacks, (callback: FormatChangeCallback) => {
            callback(true, { node, format, parents });
          });

          newFormats[format] = data.callbacks;
        }

        matchedFormats[format] = data.callbacks;
        return false;
      }

      if (MatchFormat.matchesUnInheritedFormatSelector(editor, node, format)) {
        return false;
      }
    });
  });

  // Check if current formats still match
  const remainingFormats = filterRemainingFormats(currentFormats.get(), matchedFormats, elm, parents);

  // Update the current formats
  currentFormats.set({
    ...newFormats,
    ...remainingFormats
  });
};
开发者ID:tinymce,项目名称:tinymce,代码行数:42,代码来源:FormatChanged.ts

示例8: function

 editor.on('BeforeExecCommand', function (e) {
   if (isPastePlainTextCommand(e.command)) {
     pasteFormat.set('text');
   }
   return true;
 });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:6,代码来源:Clipboard.ts

示例9:

 const setPatterns = (newPatterns: Pattern[]) => {
   patternsState.set(createPatternSet(newPatterns));
 };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:3,代码来源:Api.ts


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