medium-editor-tables icon indicating copy to clipboard operation
medium-editor-tables copied to clipboard

Deleting rows / colums doesn't work

Open makeittech opened this issue 7 years ago • 4 comments

After removing a row, visually it removes, but after saving the page I still see my table with all rows and it's content (changes are reverting back), so I can not remove row or column at all. Is there some way to fix it?

makeittech avatar Apr 27 '17 07:04 makeittech

@must2die

Several ways to solve this:

Edit something via keyboard after using a table related toolbar option or modify the extension... or try to track dom changes inside of the medium editor instance... all this is a bit tricky...

Reason is that changes introduced to the dom directly aren't captured by the Medium Editor and thus the Medium Editor events do not fire.

My solution in this context:

  1. save the current selection...
  2. move cursor to the beginning of the editor instance
  3. paste something unvisible using Medium editor pasteHTML
  4. remove the something from the dom
  5. Restore the saved selection
  6. trigger the Medium editor editableInput event

Probably there's a better way to do this but this recipe works.

leotiger avatar May 10 '17 10:05 leotiger

Thanks, @leotiger ! That really works for me)

makeittech avatar May 10 '17 12:05 makeittech

Same problem here.

havran avatar Jun 30 '17 10:06 havran

I found simple solution.

editor.subscribe('blur', function (event, editable) {
  // update input with changed MediumEditor html on blur (for example click to submit button)
  $('#medium-editor-input').val(editor.getContent());
});

havran avatar Jun 30 '17 10:06 havran