ui-tinymce icon indicating copy to clipboard operation
ui-tinymce copied to clipboard

Holding backspace down to delete all the characters does not update the model

Open chuckconway opened this issue 8 years ago • 2 comments

I'm having an issue where holding down the backspace key removes all the characters from the editor, but it does not update the angular model.

From what I can tell this code is not firing:

      updateView = function(editor) {
        var content = editor.getContent({format: options.format}).trim();
        content = $sce.trustAsHtml(content);

        ngModel.$setViewValue(content);
        if (!$rootScope.$$phase) {
          scope.$digest();
        }
      };

Steps to reproduce:

  1. Enter text into the editor
  2. Put the cursor at the end of the text and hold the backspace key down until all text is removed from the tinyMCE editor.
  3. Even though the editor is blank, text is still displayed from the model.

What I'm expecting is the data entered to be deleted from the model. However, the editor doesn't have any text but the ng-model is still displaying text.

I've created a plunker where this issue is reproducible. https://plnkr.co/edit/l2TivBCPhWrZbtFRmLJ9

chuckconway avatar Mar 29 '17 05:03 chuckconway

I've discovered a workaround -- set debounce to 'false'.

I've also noticed debounced to hardcoded to 400ms. Maybe make this a configurable value?

When I reduce the debounce to 50ms, I'm no longer able to reproduce the issue.

chuckconway avatar Mar 29 '17 07:03 chuckconway

+1

murilozilli avatar Apr 27 '18 21:04 murilozilli