How to use the tinymce/core/api/util/Tools.extend function in tinymce

To help you get started, we’ve selected a few tinymce examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tinymce / tinymce / modules / tinymce / src / plugins / paste / main / ts / core / Clipboard.ts View on Github external
const getClipboardContent = (editor: Editor, clipboardEvent: ClipboardEvent) => {
  const content = getDataTransferItems(clipboardEvent.clipboardData || (editor.getDoc() as any).dataTransfer);

  // Edge 15 has a broken HTML Clipboard API see https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11877517/
  return Utils.isMsEdge() ? Tools.extend(content, { 'text/html': '' }) : content;
};
github tinymce / tinymce / modules / tinymce / src / plugins / importcss / main / ts / core / ImportCss.ts View on Github external
const processSelector = function (selector: string, group: StyleGroup) {
      if (isUniqueSelector(editor, selector, group, globallyUniqueSelectors)) {
        markUniqueSelector(editor, selector, group, globallyUniqueSelectors);

        const format = convertSelectorToFormat(editor, editor.plugins.importcss, selector, group);
        if (format) {
          const formatName = format.name || DOMUtils.DOM.uniqueId();
          editor.formatter.register(formatName, format);

          // NOTE: itemDefaults has been removed as it was not supported by bridge and its concept
          // is handled elsewhere.
          return Tools.extend({}, {
            title: format.title,
            format: formatName
          });
        }
      }

      return null;
    };
github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / backstage / UrlInputBackstage.ts View on Github external
return Future.nu((completer) => {
        const handler = (value: string, meta?: Record) => {
          if (!Type.isString(value)) {
            throw new Error('Expected value to be string');
          }
          if (meta !== undefined && !Type.isObject(meta)) {
            throw new Error('Expected meta to be a object');
          }
          const r: UrlData = { value, meta };
          completer(r);
        };
        const meta = Tools.extend({ filetype }, Option.from(entry.meta).getOr({}));
        // file_picker_callback(callback, currentValue, metaData)
        picker.call(editor, handler, entry.value, meta);
      });
    };
github tinymce / tinymce / modules / tinymce / src / plugins / media / main / ts / core / HtmlToData.ts View on Github external
start (name, attrs) {
      if (!data.source1 && name === 'param') {
        data.source1 = attrs.map.movie;
      }

      if (name === 'iframe' || name === 'object' || name === 'embed' || name === 'video' || name === 'audio') {
        if (!data.type) {
          data.type = name;
        }

        data = Tools.extend(attrs.map, data);
      }

      if (name === 'script') {
        const videoScript = getVideoScriptMatch(prefixes, attrs.map.src);
        if (!videoScript) {
          return;
        }

        data = {
          type: 'script',
          source1: attrs.map.src,
          width: String(videoScript.width),
          height: String(videoScript.height)
        };
      }
github tinymce / tinymce / modules / tinymce / src / plugins / importcss / main / ts / core / ImportCss.ts View on Github external
return Tools.map(groups, function (group) {
    return Tools.extend({}, group, {
      original: group,
      selectors: {},
      filter: compileFilter(group.filter),
      item: {
        text: group.title,
        menu: []
      }
    });
  });
};
github tinymce / tinymce / modules / tinymce / src / plugins / image / main / ts / core / Uploader.ts View on Github external
handler(blobInfo, resolve, reject, Fun.noop);
      } catch (ex) {
        reject(ex.message);
      }
    });
  };

  const isDefaultHandler = (handler: Function) => {
    return handler === defaultHandler;
  };

  const upload = (blobInfo: BlobInfo): Promise => {
    return (!settings.url && isDefaultHandler(settings.handler)) ? Promise.reject('Upload url missing from the settings.') : uploadBlob(blobInfo, settings.handler);
  };

  settings = Tools.extend({
    credentials: false,
    handler: defaultHandler
  }, settings);

  return {
    upload
  };
};
github tinymce / tinymce / modules / tinymce / src / plugins / media / main / ts / core / DataToHtml.ts View on Github external
const dataToHtml = function (editor: Editor, dataIn: MediaData) {
  const data: MediaData = Tools.extend({}, dataIn);

  if (!data.source1) {
    Tools.extend(data, HtmlToData.htmlToData(Settings.getScripts(editor), data.embed));
    if (!data.source1) {
      return '';
    }
  }

  if (!data.source2) {
    data.source2 = '';
  }

  if (!data.poster) {
    data.poster = '';
  }