TinyMCE 4.x with Angular 1.5.x with ng-repeat getContent of Edited TinyMce Editors

227 Views Asked by At

Iam creating TinyMce-Editors through ng-repeat.
The Official Doc to Angular is not really Helpfull
https://www.tinymce.com/docs/integrations/angularjs/
So Iam asking here for Help :)
After a User did some Edits he shall be able to save this Edits or all Edited Fields in a Database.
Creating the TinyMces in my
HTML

    <tbody>
            <tr dir-paginate="v in visibleItems = ($ctrl.myCollection| filter:{Name:searchK,value1:searchV}| filterByProd:selectedProduct) |orderBy: sortType:sortReverse|itemsPerPage:10 as results">
             <td>
              <div ui-tinymce='tinymceOptions' ng-model='v.value2'></div>
<!-- in v.value2 is some Text from Databse which I set in the created Editors -->             
</td>
</tbody>

controller.js

    'use strict';

    (function(){

    class HelpComponent {
      constructor($http, $scope) {
          this.$http = $http;
          this.$scope = $scope;
          this.$scope.tinymceOptions ={
            selector: 'div',
            plugins: 'save code',
            save_enablewhendirty: true,
            save_onsavecallback: () => {console.log('Save');},
            toolbar1:' undo redo | bold underline italic | alignleft aligncenter alignright',
            toolbar2: 'save | code'
          };
        }//closing constructor
 getContent(){
   angular.forEach(this.myCollection, value =>{
     console.log(value);//iteratin my collection  //how to iterate all Editors?
   })
   }
    ... some more code
    }//closing class

    angular.module('App')
      .component('help', {
        templateUrl: 'help.html',
        controller: HelpComponent,
      });
    })();
  1. Question: The Plugin of Tiny save shows me the Save Button and is only active after some Edits. But Clicking on the Button is not doing anything but shall call

    save_onsavecallback: () => {console.log('Save');}//no console log output,

  2. Question: How can I Iterate through all Editors and get only the Edited ones? In the docs is the

    tinyMCE.activeEditor.isDirty()

Function. What means tinyMCE? -> have I just to write or does it stands for something?
activeEditor ? -> I want to Iterate so there I have to place a Variable?

0

There are 0 best solutions below