ngWig
ngWig copied to clipboard
custom button - append content
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 You can add a binding for the content
, which is the content of the editor, and access that later in your component.
@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);
}
}
}
@bampakoa nevermind, it was a misstype i was using binds and it is bindings