tinymce icon indicating copy to clipboard operation
tinymce copied to clipboard

How to exit blockquote block or div

Open nguyenkiidu opened this issue 8 years ago • 8 comments

Steps to reproduce:

  1. Clicking blockquote icon
  2. Insert the content
  3. No way to move the cursor to go out of <blockquote></blockquote>

it's the same issue if I change <blockquote></blockquote> to <div></div>

But for <table></table> or <a></a>, I can use left arrow or right arrow to exit the table block please try: https://codepen.io/hoangnt142/pen/GGKBMw many thanks!!

nguyenkiidu avatar May 28 '18 19:05 nguyenkiidu

I resolved this problem by using this config we need to press ESC button to exit

init_instance_callback: function (editor) {
  editor.on('KeyDown', function (e) {
    if(e.keyCode == 27) {
      let editor = tinyMCE.activeEditor
      const dom = editor.dom
      const parentBlock = tinyMCE.activeEditor.selection.getSelectedBlocks()[0]
      const containerBlock = parentBlock.parentNode.nodeName == 'BODY' ? dom.getParent(parentBlock, dom.isBlock) : dom.getParent(parentBlock.parentNode, dom.isBlock)
      let newBlock = tinyMCE.activeEditor.dom.create('p')
      newBlock.innerHTML = '<br data-mce-bogus="1">';
      dom.insertAfter(newBlock, containerBlock)
      let rng = dom.createRng();
      newBlock.normalize();
      rng.setStart(newBlock, 0);
      rng.setEnd(newBlock, 0);
      editor.selection.setRng(rng);
    }
  });
},

nguyenkiidu avatar May 31 '18 07:05 nguyenkiidu

Same problem, nguyenkiidu's config work like a charm.

hlthi avatar Jun 01 '18 23:06 hlthi

Many thanks

pniaps avatar Oct 26 '18 09:10 pniaps

Hi, nguyenkiidu. I think I have similar problem, because its not possible exit from DVI in WYSIWYG mode in TinyMCE with enter, ctrl+enter, keyboard arrow or anything else. Only solution is switch to code and add new content after

manually.

Can you or somebody else please answer where this fixing code supposed to go? I'm using Tinymce in Joomla.

AkiraErebos avatar Dec 16 '18 23:12 AkiraErebos

@AkiraErebos hi, you can add it inside tinymce.init this is an example
https://gist.github.com/nguyenkiidu/c102065f2c475d18521ebf14d168498b

nguyenkiidu avatar Dec 17 '18 13:12 nguyenkiidu

This issue has been closed due to inactivity. Tiny will soon be working with members of the community to close other old issues on our GitHub repositories. There are some excellent discussions and reports in the main TinyMCE GitHub repository, but with so many open issues, we cannot monitor them all. Reviewing all of the issues individually would be an enormous task, requiring time that could be better spent developing new features and fixing bugs. Therefore, we are closing issues that have been inactive for over 365 days, with some exceptions. If this issue is still relevant, please re-open this issue or create a new one. If you have any questions or concerns, you can contact me at [email protected]. You can also join the discussion on our mailing list at the following link: [email protected].

thedrjim avatar Dec 18 '20 05:12 thedrjim

This problem still exist. The configuration suggested by nguyenkiidu works but cannot work for mobile users.

Actually instagram's embed use blockquote so users can't get out of instagram blockquote.

Is there anyways to help ?

edit: The only solution I found is to force wrap the blockquote with a paragraphe tag <p><blockquote></blockquote></p>

Maxhou00 avatar Aug 14 '22 14:08 Maxhou00

I resolved this problem by using this config we need to press ESC button to exit

init_instance_callback: function (editor) {
  editor.on('KeyDown', function (e) {
    if(e.keyCode == 27) {
      let editor = tinyMCE.activeEditor
      const dom = editor.dom
      const parentBlock = tinyMCE.activeEditor.selection.getSelectedBlocks()[0]
      const containerBlock = parentBlock.parentNode.nodeName == 'BODY' ? dom.getParent(parentBlock, dom.isBlock) : dom.getParent(parentBlock.parentNode, dom.isBlock)
      let newBlock = tinyMCE.activeEditor.dom.create('p')
      newBlock.innerHTML = '<br data-mce-bogus="1">';
      dom.insertAfter(newBlock, containerBlock)
      let rng = dom.createRng();
      newBlock.normalize();
      rng.setStart(newBlock, 0);
      rng.setEnd(newBlock, 0);
      editor.selection.setRng(rng);
    }
  });
},

This helped me for sure. Cool workaround.

babazookz avatar Jan 23 '23 13:01 babazookz