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

Add ability to disable input on editor making it readonly #101

Merged
merged 1 commit into from
Mar 21, 2017

Conversation

connorwyatt
Copy link

@connorwyatt connorwyatt commented Feb 27, 2017

I have been trying to implement this editor for a little while and eventually found the need to make the input readonly. I'm aware that I could just switch out the editor for a web view to view the content but then you don't have consistency between the editor and the web view.

Using setFocusable, setClickable and setLongClickable mean that you can't select the text to copy it.

So instead I change the contentEditable property of the editor node in the JS.

I also removed the user-select and user-modify from the CSS as you were mixing two different methods by doing so and it would have required adding a class to override the default styles as well. I chose contenteditable as it has better browser support.

Let me know your thoughts.

P.S. It appears that it would fix issue #79 as well

@@ -86,6 +86,10 @@ RE.setPlaceholder = function(placeholder) {
RE.editor.setAttribute("placeholder", placeholder);
}

RE.setInputEnabled = function(inputEnabled) {
RE.editor.contentEditable = String(inputEnabled);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frakc
Copy link

frakc commented Mar 17, 2017

@connorwyatt Hello, thatnk for grate PR, can I ask if you found how to make links clicable?)

@connorwyatt
Copy link
Author

@frakc The easiest way I can think to make that happen is to preventDefault on the anchor click events, and then use a javascript interface provided by Android to notify the Android application. That way you can pass the url to the application.

@wasabeef wasabeef merged commit 1de189c into wasabeef:master Mar 21, 2017
@wasabeef
Copy link
Owner

@connorwyatt
Thanks, great.

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

Successfully merging this pull request may close these issues.

None yet

3 participants