Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't un-blockquote a quote in editor #761

Closed
bert-bruggeman opened this issue Oct 30, 2017 · 10 comments
Closed

Can't un-blockquote a quote in editor #761

bert-bruggeman opened this issue Oct 30, 2017 · 10 comments

Comments

@bert-bruggeman
Copy link

bert-bruggeman commented Oct 30, 2017

- Do you want to request a feature or report a bug?
Bug
- What is the current behavior?
Selecting an existing blockquote in the editor doesn't highlight the blockquote icon, after clicking on the icon the editor creates a blockquote in the existing blockquote...

- What is the expected behavior?
the blockquote icon should be highlighted when an existing quote is selected, the blockquote should be un-quoted after clicking it..
- Please mention your CMS, node.js, and operating system version.
Cms 0.6, chrome on fedora linux 23

@erquhart
Copy link
Contributor

erquhart commented Nov 7, 2017

@bert-bruggeman having a hard time reproducing - here's what I'm seeing:

cms-761-unblock-quote

@bert-bruggeman
Copy link
Author

The issue only appears on existing entries...

@erquhart
Copy link
Contributor

erquhart commented Nov 27, 2017

Ah, yep, got it. Looks like it doesn't recognize when a blockquote is active on load for some reason.

@cwahlfeldt
Copy link

I'm working on this!

@cwahlfeldt
Copy link

cwahlfeldt commented Jan 16, 2018

It seems that the HTML is changed when viewing a Markdown widget in a post that already has a blockquote. When you make a blockquote using the editor the original html that it produces is:

<blockquote>
  <span>text</span>
</blockquote>

Upon revisiting the post edit page from the dashboard, the html changes to a blockquote with a paragraph as its child instead of a span and thus thinks its a paragraph not a quote.

<blockquote>
  <p>text</p>
</blockquote>

Not sure how it "re-hydrates" data when its viewed again? Also note that this isn't retrieving from a file, I believe its retrieving the data from localstorage or some other storage (localforage?). Still learning a ton about the ENV so bear with me. Cheers!

@erquhart
Copy link
Contributor

@cwahlfeldt so glad you're digging into this!

The storage is actually whatever backend Netlify CMS is using (which currently can only be GitHub for live projects), it loads the entry fresh each time it's opened.

From a high level:

  1. the markdown widget is a Slate editor
  2. we use Remark as our Markdown AST
  3. when a change occurs in the editor, Slate stores it (in it's own Slate AST)
  4. we manually create our own Remark AST from that - e.g., quote node is parsed here
  5. the Remark AST is the source of truth for the widget and the preview
  6. the preview is updated by a Remark module that converts the Remark AST to HTML
  7. when we save and persist the entry, the Remark AST is serialized to a Markdown string
  8. on entry load, the Markdown is converted to Remark AST by Remark (not manually as before)

I'm betting there's a difference between the Remark AST quote node that we create ourselves and the node that Remark creates when parsing from the Markdown string on load.

@stale
Copy link

stale bot commented Oct 29, 2019

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.

@stale stale bot added the status: stale label Oct 29, 2019
@bytrangle
Copy link
Collaborator

This issue was a long time ago, but can @bert-bruggeman or anyone with write access please revise the issue title?
At present, we can un-blockquote a quote in the editor. The only problem is that when an existing blockquote loses focus, and then got focussed again (either by clicking or selecting it), the blockquote toolbar icon is not highlighted.

blockquote-toolbar-button

@bytrangle
Copy link
Collaborator

@erquhart: This issue was opened three years ago and a lot of things have changed in the Netlify CMS. There was two parts in the original issue:

  • Select an existing quoteblock in the editor, then click the quoteblock toolbar icon should un-blockquote it.
  • Selecting an existing quoteblock doesn't highlight the quoteblock icon in the toolbar.

Currently, the first part seems to have been solved. I can select a quoteblock, then click the quoteblock button to toggle it on and off.

However, the second parts still remains. Indeed, I've discovered another issue.

All the text styles offered by the editor can be divided into three groups:

  • block element (Headings from H1 to H6, quoteblock, bulleted list, numbered list).
  • mark element (bold, italic, code)
  • inline element (hyperlink)

Selecting either quoteblock, numbered list and bulleted list doesn't highlight the relevant icon in the toolbar. However, selecting the heading works fine.

Please see the demo below.

block-style-button-doesnt-highlight

Should I create a separate issue for this?

@erezrokah
Copy link
Contributor

Should I create a separate issue for this?

Hi @bytrangle, that's a good idea. I'll close this one. Can you please open a new one with a reproduction and link to this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants