You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Cursor support for medium.js is good but not enough. Like it lacks some basic cursor position support, i.e. if the cursor is at the end of the element?
I tried to add two functions: isCaretAtBegin and isCaretAtEnd. which could support some basic cursor position support.
However, when using this two function upon nested elements, the
rangy.getSelection()
will get the last inner element other than the very outer element.
For example, use
rangy.getSelection()
for element
<p>this is a test paragraph,<span>ho ho ho</span></p>,
the selection will be the inner span other than the p element, so even you place the cursor at the end of this paragraph, the
el.innerText.length
will be 33 and
sel.anchorOffset
will be 8.
I just wonder if these kind of functions is needed, I could work on it to improve Medium.js since this is the best open source WYSIWYG editor I have met.
The text was updated successfully, but these errors were encountered:
The Cursor support for medium.js is good but not enough. Like it lacks some basic cursor position support, i.e. if the cursor is at the end of the element?
I tried to add two functions: isCaretAtBegin and isCaretAtEnd. which could support some basic cursor position support.
However, when using this two function upon nested elements, the
will get the last inner element other than the very outer element.
For example, use
for element
the selection will be the inner span other than the p element, so even you place the cursor at the end of this paragraph, the
will be 33 and
will be 8.
I just wonder if these kind of functions is needed, I could work on it to improve Medium.js since this is the best open source WYSIWYG editor I have met.
The text was updated successfully, but these errors were encountered: