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


TypeScript katamari.Option類代碼示例

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


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

示例1: function

 const getTopNotification = function () {
   return Option.from(notifications[0]);
 };
開發者ID:abstask,項目名稱:tinymce,代碼行數:3,代碼來源:NotificationManager.ts

示例2: function

const extractBlob = function (simulatedEvent) {
  const event = simulatedEvent.event();
  const files = event.raw().target.files || event.raw().dataTransfer.files;
  return Option.from(files[0]);
};
開發者ID:abstask,項目名稱:tinymce,代碼行數:5,代碼來源:ImagePicker.ts

示例3:

 const toResult = (info, param) => Option.from(info[param]).fold(() => Result.error('Missing ' + param), Result.value);
開發者ID:tinymce,項目名稱:tinymce,代碼行數:1,代碼來源:LinkBridgeTest.ts

示例4: function

 function (paddPos) {
   if (moveCaret) {
     setSelection(editor, forward, Option.some(paddPos));
   }
 }
開發者ID:tinymce,項目名稱:tinymce,代碼行數:5,代碼來源:DeleteElement.ts

示例5: isWithinSameTable

 (cellRng: any) => isWithinSameTable(isRoot, cellRng) ? Option.none() : getCellRangeFromStartTable(cellRng, isRoot)
開發者ID:abstask,項目名稱:tinymce,代碼行數:1,代碼來源:TableDeleteAction.ts

示例6: function

 function (element) { // After
   CaretContainerRemove.remove(caret.get());
   const text = CaretContainerInline.insertInlineAfter(element);
   caret.set(text);
   return Option.some(new CaretPosition(text, 1));
 }
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:6,代碼來源:BoundaryCaret.ts

示例7: function

const sketch = function (settings) {
  const dataset = convert(settings.formats, function () {
    return memMenu;
  });
  // Turn settings into a tiered menu data.

  const memMenu = Memento.record(TieredMenu.sketch({
    dom: {
      tag: 'div',
      classes: [ Styles.resolve('styles-menu') ]
    },
    components: [ ],

    // Focus causes issues when the things being focused are offscreen.
    fakeFocus: true,
    // For animations, need things to stay around in the DOM (at least until animation is done)
    stayInDom: true,

    onExecute (tmenu, item) {
      const v = Representing.getValue(item);
      settings.handle(item, v.value);
      return Option.none();
    },
    onEscape () {
      return Option.none();
    },
    onOpenMenu (container, menu) {
      const w = Width.get(container.element());
      Width.set(menu.element(), w);
      Transitioning.jumpTo(menu, 'current');
    },
    onOpenSubmenu (container, item, submenu) {
      const w = Width.get(container.element());
      const menu = SelectorFind.ancestor(item.element(), '[role="menu"]').getOrDie('hacky');
      const menuComp = container.getSystem().getByDom(menu).getOrDie();

      Width.set(submenu.element(), w);

      Transitioning.progressTo(menuComp, 'before');
      Transitioning.jumpTo(submenu, 'after');
      Transitioning.progressTo(submenu, 'current');
    },

    onCollapseMenu (container, item, menu) {
      const submenu = SelectorFind.ancestor(item.element(), '[role="menu"]').getOrDie('hacky');
      const submenuComp = container.getSystem().getByDom(submenu).getOrDie();
      Transitioning.progressTo(submenuComp, 'after');
      Transitioning.progressTo(menu, 'current');
    },

    navigateOnHover: false,

    highlightImmediately: true,
    data: dataset.tmenu,

    markers: {
      backgroundMenu: Styles.resolve('styles-background-menu'),
      menu: Styles.resolve('styles-menu'),
      selectedMenu: Styles.resolve('styles-selected-menu'),
      item: Styles.resolve('styles-item'),
      selectedItem: Styles.resolve('styles-selected-item')
    }
  }));

  return memMenu.asSpec();
};
開發者ID:tinymce,項目名稱:tinymce,代碼行數:66,代碼來源:StylesMenu.ts

示例8:

 return table.bind(function (table) {
   const doc = Element.fromDom(editor.getDoc());
   const targets = TableTargets.forMenu(selections, table, cell);
   const generators = TableFill.cellOperations(Fun.noop, doc, Option.none());
   return CopyRows.copyRows(table, targets, generators);
 });
開發者ID:,項目名稱:,代碼行數:6,代碼來源:

示例9: function

const setup = function (realm, editor) {
  const commandSketch = function (name) {
    return function () {
      return Buttons.forToolbarCommand(editor, name);
    };
  };

  const stateCommandSketch = function (name) {
    return function () {
      return Buttons.forToolbarStateCommand(editor, name);
    };
  };

  const actionSketch = function (name, query, action) {
    return function () {
      return Buttons.forToolbarStateAction(editor, name, query, action);
    };
  };

  const undo = commandSketch('undo');
  const redo = commandSketch('redo');
  const bold = stateCommandSketch('bold');
  const italic = stateCommandSketch('italic');
  const underline = stateCommandSketch('underline');
  const removeformat = commandSketch('removeformat');

  const link = function () {
    return LinkButton.sketch(realm, editor);
  };

  const unlink = actionSketch('unlink', 'link', function () {
    editor.execCommand('unlink', null, false);
  });
  const image = function () {
    return ImagePicker.sketch(editor);
  };

  const bullist = actionSketch('unordered-list', 'ul', function () {
    editor.execCommand('InsertUnorderedList', null, false);
  });

  const numlist = actionSketch('ordered-list', 'ol', function () {
    editor.execCommand('InsertOrderedList', null, false);
  });

  const fontsizeselect = function () {
    return FontSizeSlider.sketch(realm, editor);
  };

  const forecolor = function () {
    return ColorSlider.sketch(realm, editor);
  };

  const styleFormats = StyleFormats.register(editor, editor.settings);

  const styleFormatsMenu = function () {
    return StyleFormats.ui(editor, styleFormats, function () {
      editor.fire('scrollIntoView');
    });
  };

  const styleselect = function () {
    return Buttons.forToolbar('style-formats', function (button) {
      editor.fire('toReading');
      realm.dropup().appear(styleFormatsMenu, Toggling.on, button);
    }, Behaviour.derive([
      Toggling.config({
        toggleClass: Styles.resolve('toolbar-button-selected'),
        toggleOnExecute: false,
        aria: {
          mode: 'pressed'
        }
      }),
      Receiving.config({
        channels: Objects.wrapAll([
          Receivers.receive(TinyChannels.orientationChanged(), Toggling.off),
          Receivers.receive(TinyChannels.dropupDismissed(), Toggling.off)
        ])
      })
    ]));
  };

  const feature = function (prereq, sketch) {
    return {
      isSupported () {
        // NOTE: forall is true for none
        return prereq.forall(function (p) {
          return Objects.hasKey(editor.buttons, p);
        });
      },
      sketch
    };
  };

  return {
    undo: feature(Option.none(), undo),
    redo: feature(Option.none(), redo),
    bold: feature(Option.none(), bold),
    italic: feature(Option.none(), italic),
    underline: feature(Option.none(), underline),
//.........這裏部分代碼省略.........
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:101,代碼來源:Features.ts

示例10: function

import { Arr, Fun, Option } from '@ephox/katamari';
import { CopyRows, TableFill, TableLookup } from '@ephox/snooker';
import { Element, Insert, Remove, Replication } from '@ephox/sugar';

import Tools from 'tinymce/core/api/util/Tools';

import Util from '../alien/Util';
import TableTargets from '../queries/TableTargets';
import CellDialog from '../ui/CellDialog';
import RowDialog from '../ui/RowDialog';
import TableDialog from '../ui/TableDialog';

const each = Tools.each;

let clipboardRows = Option.none();

const getClipboardRows = function () {
  return clipboardRows.fold(function () {
    return;
  }, function (rows) {
    return Arr.map(rows, function (row) {
      return row.dom();
    });
  });
};

const setClipboardRows = function (rows) {
  const sugarRows = Arr.map(rows, Element.fromDom);
  clipboardRows = Option.from(sugarRows);
};
開發者ID:,項目名稱:,代碼行數:30,代碼來源:


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