当前位置: 首页>>代码示例>>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;未经允许,请勿转载。