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

Deleting the entire content of the editor switches Direction #76

Open
PostMidnight opened this issue Aug 1, 2019 · 1 comment
Open

Comments

@PostMidnight
Copy link

Solution that works (for now):

quill.on('text-change', function () {
			if (isEmpty(quill)) {
				console.log('empty!!');
				//quill.deleteText(0, quill.getLength());
				//quill.setText('​');
				textareaEl.val('');
				return;
			}
			textareaEl.val(JSON.stringify(quill.getContents()));
			textareaEl.trigger('change');
		});

@PostMidnight
Copy link
Author

Generally, I see that its better to repalce 'setText('') with setContents, see below:
To that end, I recommend changing $(window).on('action:chat.sent', function (evt, data) accordingly.

                //quill.setText('');
		let textDirection = $('html').attr('data-dir');
		quill.setContents({ ops: [{
				insert: '\n',
				attributes: {
					direction: textDirection,
					align: textDirection === 'rtl' ? 'right' : 'left',
				},
			}] }, 'api');

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

1 participant