tinymce / tinymce-contentful

TinyMCE for Contentful
https://www.tiny.cloud/blog/is-the-headless-cms-the-future-of-content-publishing/
Apache License 2.0
7 stars 32 forks source link

Allow for configuration of Word and HTML import types #7

Open danfusaro opened 2 years ago

danfusaro commented 2 years ago

As described in

Allow for Contentful admins to change the default values (e.g. "merge") for HTML imports when using the PowerPaste feature.

exalate-issue-sync[bot] commented 2 years ago

Ref: INT-2914

danfusaro commented 2 years ago

I can submit a PR for this if you'd like!

danfusaro commented 2 years ago

Proposed changes: tinymce-for-contentful.js

var p = tweak(api.parameters.instance.plugins);
    var tb = tweak(api.parameters.instance.toolbar);
    var mb = tweak(api.parameters.instance.menubar);
    var ppwi = tweak(api.parameters.instance.wordImport);
    var pphi = tweak(api.parameters.instance.htmlImport);

    api.window.startAutoResizer();

    tinymce.init({
      selector: "#editor",
      plugins: p,
      toolbar: tb,
      menubar: mb,
      min_height: 600,
      max_height: 750,
      autoresize_bottom_margin: 15,
      resize: false,
      image_caption: true,
      powerpaste_word_import: ppwi,
      powerpaste_html_import: pphi,
...

extension.json:

...
{
        "id": "wordImport",
        "name": "Word Import Type",
        "type": "Symbol",
        "default": "prompt",
        "required": false,
        "description": "This setting controls how content being pasted from Microsoft Word is filtered. Possible values: clean, merge, prompt"
      },
      {
        "id": "htmlImport",
        "name": "HTML Import Type",
        "type": "Symbol",
        "default": "clean",
        "required": false,
        "description": "This setting controls how content being pasted from sources other than Microsoft Word is filtered. Note that this includes content copied from TinyMCE itself. Possible values: clean, merge, prompt"
      }