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

How to disable touch? #24

Open
Juxtlie opened this issue Apr 20, 2017 · 3 comments
Open

How to disable touch? #24

Juxtlie opened this issue Apr 20, 2017 · 3 comments

Comments

@Juxtlie
Copy link

Juxtlie commented Apr 20, 2017

Hello.Sometimes I need to disable focus on the textinpunt . How to make it?
Best Regards

@Shujito
Copy link

Shujito commented Jul 14, 2017

Have you tried placing a touchable view over the editor?

@ethanyuwang
Copy link

You can add your own methods in editor.html to support disabling/enabling editing:

			zss_editor.disableContentEditing = function(html) {
				$('#zss_editor_content').attr('contenteditable','false');
			}

			zss_editor.enableContentEditing = function(html) {
				$('#zss_editor_content').attr('contenteditable','true');
			}

Then in 'const.js':

  disableContentEditing: 'DISABLE_CONTENT_EDITING',
  enableContentEditing: 'ENABLE_CONTENT_EDITING',

Add the following to your WebviewMessageHandler.js:

        case '${actions.disableContentEditing}':
          zss_editor.disableContentEditing();
          break;
        case '${actions.enableContentEditing}':
          zss_editor.enableContentEditing();
          break;

Finally, add the methods in your 'RichTextEditor.js':

  disableContentEditing() {
    this._sendAction(actions.disableContentEditing);
  }

  enableContentEditing() {
    this._sendAction(actions.enableContentEditing);
  }

You can just call disableContentEditing and enableContentEditing to disable and re-enable touch

@mattslight
Copy link

Can confirm this works. @ethanyuwang Thank you.

I modified the functions slightly for my particular use case so that title editing is controlled too, e.g.

      zss_editor.disableContentEditing = function(html) {
				$('#zss_editor_content').attr('contenteditable','false');
        $('#zss_editor_title').attr('contenteditable','false');
			}

			zss_editor.enableContentEditing = function(html) {
				$('#zss_editor_content').attr('contenteditable','true');
        $('#zss_editor_title').attr('contenteditable','true');
			}

fkesheh pushed a commit to trilogy-group/react-native-zss-rich-text-editor that referenced this issue Dec 12, 2022
…croll

Unable to scroll to end of editor after embedding multiple images
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

No branches or pull requests

4 participants