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


TypeScript katamari.Obj類代碼示例

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


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

示例1: Error

const register = (editor: Editor): AutocompleterDatabase => {
  const popups = editor.ui.registry.getAll().popups;
  const dataset = Obj.map(popups, (popup) => {
    return InlineContent.createAutocompleter(popup).fold(
      (err) => {
        throw new Error(ValueSchema.formatError(err));
      },
      (x) => x
    );
  });

  const triggerChars = Unique.stringArray(
    Obj.mapToArray(dataset, (v) => v.ch)
  );

  const datasetValues = Obj.values(dataset);

  const lookupByChar = (ch: string): InlineContent.Autocompleter[] => {
    return Arr.filter(datasetValues, (dv) => dv.ch === ch);
  };

  return {
    dataset,
    triggerChars,
    lookupByChar
  };
};
開發者ID:tinymce,項目名稱:tinymce,代碼行數:27,代碼來源:Autocompleters.ts

示例2:

 const getCellPaddingCellSpacing  = () => {
   const spacing = Obj.get(style, 'border-spacing').or(Obj.get(attrs, 'cellspacing')).fold( () => ({}), (cellspacing) => ({ cellspacing }));
   const padding = Obj.get(style, 'border-padding').or(Obj.get(attrs, 'cellpadding')).fold( () => ({}), (cellpadding) => ({ cellpadding }));
   return {
     ...spacing,
     ...padding
   };
 };
開發者ID:tinymce,項目名稱:tinymce,代碼行數:8,代碼來源:Helpers.ts

示例3: cSetFieldValue

 const chains = Arr.flatten(Obj.mapToArray(tabSelectors, (value, key): Chain<any, any>[] => {
   if (Obj.has(data, key)) {
     const newValue = typeof data[key] === 'object' ? data[key].value : data[key];
     return [ cSetFieldValue(tabSelectors[key], newValue) ];
   } else if (Obj.has(data, 'dimensions') && Obj.has(data.dimensions, key)) {
     return [ cSetFieldValue(tabSelectors[key], data.dimensions[key]) ];
   } else {
     return [];
   }
 }));
開發者ID:tinymce,項目名稱:tinymce,代碼行數:10,代碼來源:Helpers.ts

示例4: assertMarker

const sAssertGetAll = (editor: Editor, expected: Record<string, number>, name: string) => Step.sync(() => {
  const annotations = editor.annotator.getAll(name);
  const keys = Obj.keys(annotations);
  const sortedKeys = Arr.sort(keys);
  const expectedKeys = Arr.sort(Obj.keys(expected));
  Assertions.assertEq('Checking keys of getAll response', expectedKeys, sortedKeys);
  Obj.each(annotations, (markers, uid) => {
    Assertions.assertEq('Checking number of markers for uid', expected[uid], markers.length);
    assertMarker(editor, { uid, name }, markers);
  });
});
開發者ID:tinymce,項目名稱:tinymce,代碼行數:11,代碼來源:AnnotationAsserts.ts

示例5: rgbToHex

  const extractAdvancedStyleData = (dom) => {
    const rgbToHex = (value: string) => Strings.startsWith(value, 'rgb') ? dom.toHex(value) : value;

    const borderStyle = Obj.get(style, 'border-style').getOr('');
    const borderColor = Obj.get(style, 'border-color').getOr('');
    const bgColor = Obj.get(style, 'background-color').getOr('');

    return {
      borderstyle: borderStyle,
      bordercolor: rgbToHex(borderColor),
      backgroundcolor: rgbToHex(bgColor)
    };
  };
開發者ID:tinymce,項目名稱:tinymce,代碼行數:13,代碼來源:Helpers.ts

示例6: getDimensions

export const resize = (editor: Editor, deltas, resizeType: ResizeTypes) => {
  const container = Element.fromDom(editor.getContainer());

  const dimensions = getDimensions(editor, deltas, resizeType, Height.get(container), Width.get(container));
  Obj.each(dimensions, (val, dim) => Css.set(container, dim, Utils.numToPx(val)));
  Events.fireResizeEditor(editor);
};
開發者ID:tinymce,項目名稱:tinymce,代碼行數:7,代碼來源:Resize.ts

示例7:

const getMultipleToolbarsSetting = (editor: Editor) => {
  const keys = Obj.keys(editor.settings);
  const toolbarKeys = Arr.filter(keys, (key) => /^toolbar([1-9])$/.test(key));
  const toolbars = Arr.map(toolbarKeys, (key) => editor.getParam(key, false, 'string'));
  const toolbarArray = Arr.filter(toolbars, (toolbar) => typeof toolbar === 'string');
  return toolbarArray.length > 0 ? Option.some(toolbarArray) : Option.none();
};
開發者ID:tinymce,項目名稱:tinymce,代碼行數:7,代碼來源:Settings.ts

示例8: function

 const setData = function (mime, content) {
   data[mime] = content;
   result.types = Obj.keys(data);
   result.items = Arr.map(result.types, function (type) {
     return createDataTransferItem(type, data[type]);
   });
 };
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:7,代碼來源:MockDataTransfer.ts

示例9:

 Obj.each(expected.pattern, (value, key) => {
   if (Obj.has<any, string>(pattern, key)) {
     Assertions.assertEq('Pattern ' + (i + 1) + ' property `' + key + '` is not equal', value, pattern[key]);
   } else {
     assert.fail('Pattern ' + (i + 1) + ' property `' + key + '` is missing');
   }
 });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:7,代碼來源:FindInlinePatternTest.ts


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