1

Facing issue with the textAngular editor when user copy and paste text. (clip board contains text and image)

You can find library from here https://github.com/fraywing/textAngular.

lin
  • 17,956
  • 4
  • 59
  • 83
Shiva
  • 358
  • 2
  • 15

1 Answers1

1

Checkout this fiddle. It uses ta-past directive of textAngular and replaces all image elements by using regex .replace(/<img[^>]*>/g,""); on your input string.

View

<div ng-app="test">
    <div ng-controller="testController">
        <div text-angular 
             name="testEditor" 
             ng-model="htmlContent" 
             ta-paste="stripFormat($html)"></div>
    </div>
</div>

AngularJS Application

angular.module('test', ['textAngular'])
  .controller('testController', function($scope, $timeout, textAngularManager, $filter) {

  $scope.htmlContent = '<p>Hello There!</p>';

  $scope.stripFormat = function ($html) {
    return $html.replace(/<img[^>]*>/g,"");
  };
});
lin
  • 17,956
  • 4
  • 59
  • 83