Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom button - append content #174

Open
sh4mz opened this issue Oct 16, 2017 · 3 comments
Open

custom button - append content #174

sh4mz opened this issue Oct 16, 2017 · 3 comments

Comments

@sh4mz
Copy link

sh4mz commented Oct 16, 2017

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?

@bampakoa
Copy link
Contributor

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

@andresr-clientmaker
Copy link

@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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants