ngWig icon indicating copy to clipboard operation
ngWig copied to clipboard

custom button - append content

Open sh4mz opened this issue 7 years ago • 3 comments

Hi,

Using given example : https://plnkr.co/edit/Ik2fmPzDu6ecifUqVICv?p=preview

How do i append text in the content based on user selection? how i can do this from component?

sh4mz avatar Oct 16 '17 06:10 sh4mz

@sh4mz You can add a binding for the content, which is the content of the editor, and access that later in your component.

bampakoa avatar Oct 16 '17 09:10 bampakoa

@bampakoa i did that already but this.content is always undefined, im trying to make a plugin to upload files to a server and then render the image in the content f the edutor (at cursor position ofc).

trying this so far to test if i can get the content but nope, any idea?

.component('nwMyCustomButton', { binds: { execCommand: '=', content: '=' }, template: '<button class="nw-button my-custom" title="My Custom Button" ng-click="$ctrl.insert()" title="{{$ctrl.content}}">My</button>', controllerAs: '$ctrl', controller: function() { var $ctrl = this; $ctrl.insert = function() { console.log($ctrl.content); } } }

andresr-clientmaker avatar Jul 10 '18 12:07 andresr-clientmaker

@bampakoa nevermind, it was a misstype i was using binds and it is bindings

andresr-clientmaker avatar Jul 10 '18 13:07 andresr-clientmaker