-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Editor fast follow #653
Editor fast follow #653
Conversation
eacfdcf
to
3fbe45e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I highlight text in a code block (while in visual mode), and click the italic or bold button, it locks up the whole editor (I cannot change anything), and the "H1" button is highlighted.
*/ | ||
const escapedMdast = unified() | ||
const processedMdast = unified() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 This makes a lot more sense.
/** | ||
* Return markdown with trailing whitespace removed. | ||
*/ | ||
return trimEnd(markdown); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes at least two annoying bugs I've been having, thank you!
@@ -248,6 +248,12 @@ function escape(delim) { | |||
*/ | |||
export default function remarkEscapeMarkdownEntities() { | |||
const transform = (node, index) => { | |||
/** | |||
* Shortcode nodes will intentionally inject markdown entities in text node | |||
* children not be escaped. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a typo here, or do I just not understand what it means?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, that's a typo.
3fbe45e
to
4e34541
Compare
If an undo (Ctrl+Z) causes a block to be removed (shift to another type of block), the editor loses focus. Steps to Reproduce:
This happens on redos as well (Ctrl+Y). |
|
Yeah, this is actually similar to the first bug you found - replacing the node that the cursor is in is the cause of all of them. |
0522528
to
b1847c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple (minor) style points and a weird call to flatMap
- other than that this LGTM.
@@ -435,7 +435,9 @@ function convertNode(node, children, shortcodePlugins) { | |||
* value and the "lang" data property to the new MDAST node. | |||
*/ | |||
case 'code': { | |||
const value = get(node.nodes, [0, 'text']); | |||
const value = flatMap(node.nodes, child => { | |||
return flatMap(child.ranges, 'text'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think a string is a valid iteratee for flatMap
, unless I'm missing something here. The result of this will be child.ranges
but with every value undefined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ranges
is always an array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I was misunderstanding was that a string passed to the iteratee
argument of flatMap
will be treated as an argument to an implicit properties
call, which makes this equivalent to something like flatMap(get('text'), child.ranges)
in lodash/fp or ramda. LGTM
@@ -6,7 +6,7 @@ function onKeyDown(e, data, change) { | |||
const createDefaultBlock = () => { | |||
return Block.create({ | |||
type: 'paragraph', | |||
nodes: [Text.createFromString('')] | |||
nodes: [Text.create('')] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No trailing comma; this is a linter regression.
b1847c8
to
b96b7f8
Compare
b96b7f8
to
65c9e9d
Compare
Bugfixes and improvements for the new Slate editor. Continuation of #629. Closes #575.
NOTE: merge after #638