Netlify-cms: Markdown editor in editor component applies formatting wrong after triple clicking to select entire line

Created on 12 Jun 2018  路  3Comments  路  Source: netlify/netlify-cms

- Do you want to request a feature or report a bug?

bug

- What is the current behavior?

When triple clicking a line of text in a markdown editor within an editor component, all the text gets selected:

screen shot 2018-06-12 at 13 30 44

But if I then apply styling to the selection, it only applies to the exact word I originally triple clicked on:

screen shot 2018-06-12 at 13 30 56

This does not happen in the "main" markdown editor, so I assume this isn't a bug in slate.js, but rather has to do with netlify-cms' integration, perhaps related to #1393

- If the current behavior is a bug, please provide the steps to reproduce.

  1. Define an editor component that has a field with the markdown widget:
CMS.registerEditorComponent({
  id: "youtube",
  label: "Youtube",
  fields: [{
    name: 'id',
    label: 'Youtube Video ID',
    widget: 'markdown'
  }],
  pattern: /^youtube (\S+)$/,
  fromBlock: function(match) {
    return { id: match[1] };
  },
  toBlock: function(obj) {
    return 'youtube ' + obj.id;
  },
  toPreview: function(obj) {
    return (
      '<img src="http://img.youtube.com/vi/' + obj.id + '/maxresdefault.jpg" alt="Youtube Video"/>'
    );
  }
});
  1. Create a new entry in the collection
  2. Enter several words in the markdown widget
  3. Triple click one of the words with the left mouse button to select all the text
  4. Click the Bold button

Observe that the bold styling only applies to the word that was triple clicked, rather than all the text that is selected.

The same thing happens when applying italics and creating a link.

- What is the expected behavior?

That the styling applies to all the selected text.

- Please mention your versions where applicable.

Netlify CMS version: 1.8.4
Browser version: Chrome 67.0.3396.62/OSX

Node.JS version: 9.5.0
Operating System: Mac OSX 10.13.4 (High Sierra)

- Please link or paste your config.yml below if applicable.

extensionwidgetmarkdown bug confirmed stale

All 3 comments

I think it's safe to say that markdown widgets inside of markdown widgets are just busted at this point, lots and lots of bugs there.

Related to this when you attempt to drag select text it attempts to drag the component and not select the text

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings