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

How can I get the editor object outside the on-image-upload event? #37

Closed
Pyohwan opened this issue Jan 19, 2015 · 8 comments
Closed

How can I get the editor object outside the on-image-upload event? #37

Pyohwan opened this issue Jan 19, 2015 · 8 comments
Assignees

Comments

@Pyohwan
Copy link

Pyohwan commented Jan 19, 2015

Hello.
I like angular-simmernote and I have a question.
I can upload a image using 'editor' object. 'editor' object is on-image-upload's parameter.
This object can be used only inner on-image-upload.
I'd like to use 'editor' object outside the on-image-upload too.

Thanks.

@Pyohwan Pyohwan changed the title How did i get the editor object outside the on-image-upload event? How can I get the editor object outside the on-image-upload event? Jan 19, 2015
@outsideris
Copy link
Owner

Did you mean second parameter, editor, in onImageUpload?
If so, I just followed summernote's API.
Can you provide the use case for use editor object outside the callback?

@Pyohwan
Copy link
Author

Pyohwan commented Jan 21, 2015

I added a button which is irrelevant to summernote's picture toolbar to upload a image.
If click this button, upload a image to server and return URL which is accessible to image, from server.
I'd like to append image URL at summernote's editor.
So, I have to access editor object outside the onImageUpload.

@outsideris outsideris self-assigned this Jan 21, 2015
@outsideris
Copy link
Owner

In such case, can you use ngModel?
I think you can add image url into editor if you add it into ngModel.

@Pyohwan
Copy link
Author

Pyohwan commented Jan 23, 2015

function DemoController($scope) { $scope.text = "Hello World"; }

This sample code is changes from $scope.text to "Hello World".
Is it possible to insert a image using ngModel in cursor position?

I have a time and searched this issue at Summernote.

summernote/summernote#282

var editor = $.summernote.eventHandler.getEditor();

Look at HackerWins's comment on comment list. Summernote provide plugin and can access editor object. editor object can use the functions insertText, insertImage, createLink and so on.

I think angular-summernote needs that function. What do you think?

@outsideris
Copy link
Owner

@Pyohwan
Sorry for late. I understand the problem.

<summernote editor="editor">

How about do you think the attribute name?

Actually, I already used <summernote editable="editable"> for callbacks.
But I worried about the attribute name is too general. And editor is also general.
And editor could be confuse with editable.
Do you have a idea fot it?

@Pyohwan
Copy link
Author

Pyohwan commented Feb 5, 2015

How do you think adding prefix like ng- of Angular Core module?

sm means Summernote.
But it's up to you.

@outsideris
Copy link
Owner

@Pyohwan
I digging the issue. but summernote return editor object globally, not per summernote instance.
so, $.summernote.eventHandler.getEditor() return always same object.
Therefore, developer can get Editor via summernote instead angular-summernote.
And then, they use it with editable obtain from angular-summernote

DId I missed something? How do you think?

@Pyohwan
Copy link
Author

Pyohwan commented Mar 19, 2015

That's ok.
Thank you for your help.

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

No branches or pull requests

2 participants