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

Use element.isContentEditable. Preserve contenteditable undo stack. #98

Merged
merged 1 commit into from
Aug 6, 2014
Merged

Use element.isContentEditable. Preserve contenteditable undo stack. #98

merged 1 commit into from
Aug 6, 2014

Conversation

mikol
Copy link
Contributor

@mikol mikol commented Aug 4, 2014

Use element.isContentEditable.

element.contentEditable returns the string value of the contenteditable attribute, which is not a reliable indicator of the element’s editability. For example, the attribute values inherit and plaintext-only can indicate that an element is editable. This change uses the boolean element.isContentEditable property in place of element.contentEditable, which returns true when an element is editable and false when it is not, regardless of the contenteditable attribute value.

Preserve contenteditable undo stack.

Programatic DOM manipulations of contenteditable elements other than those made with document.execCommand() break the browser’s undo stack. For example, users are not able to undo past the last jquery-textcomplete interaction because it is currently manipulating the DOM through range.deleteContents() and range.insertNode(). These changes replace range manipulations with document.execCommand() operations thus preserving the browser’s undo stack, including all jquery-textcomplete interactions.

@yuku
Copy link
Owner

yuku commented Aug 6, 2014

Hi @mikol, thanks for sending the patch.
It looks good to me!

yuku added a commit that referenced this pull request Aug 6, 2014
Use element.isContentEditable. Preserve contenteditable undo stack.
@yuku yuku merged commit 7c37862 into yuku:master Aug 6, 2014
@mikol
Copy link
Contributor Author

mikol commented Aug 6, 2014

Cool. Thanks!

/ Mikol

On Wed, Aug 6, 2014 at 1:46 AM, Yuku TAKAHASHI notifications@github.com
wrote:

Hi @mikol https://github.com/mikol, thanks for sending the patch.
It looks good to me!


Reply to this email directly or view it on GitHub
https://github.com/yuku-t/jquery-textcomplete/pull/98#issuecomment-51308442
.

@bettysteger
Copy link

hey @mikol @yuku-t ,

one question, this code is not in the latest version is it?

I would like to preserve the contenteditable undo stack :/

@mikol
Copy link
Contributor Author

mikol commented Jul 5, 2016

Hi, @lpsBetty –

Please excuse my slow reply. I am on vacation right now.

The precise code I submitted does not appear to be there any longer. But that doesn’t mean the correct support for editable content is gone. For example, the current code does use the .isContentEditable boolean, which was one of the things my PR introduced.

But I am not really a project maintainer and I only contributed this one time. I have not followed the project closely since then so I must defer all detailed Q&A about this subject to others. Perhaps I could lend a hand with a new PR if you create an issue outlining the problems you are having and how to reproduce them.

Best.

@bettysteger
Copy link

hey @mikol, thanks for your reply.

I just wanted the undo back, so that it's possible to remove a added textcomplete item with CTRL+Z ;)

@yuku yuku added the DEPRECATED jquery-textcomplete Issues associated to jquery-textcomplete (was DEPRECATED) label Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DEPRECATED jquery-textcomplete Issues associated to jquery-textcomplete (was DEPRECATED) enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants