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

Provide callback for save method #811

Closed
DE-Danloc opened this issue Jul 16, 2021 · 1 comment
Closed

Provide callback for save method #811

DE-Danloc opened this issue Jul 16, 2021 · 1 comment

Comments

@DE-Danloc
Copy link
Contributor

  • Actual behavior / problem:

    For us it is not enough to copy the content to the original textarea when save button is clicked.
    We wan't to do some business logic when the save button is clicked. With the actual behavior the easiest solution for us would
    to provide our own save button and get the editors content. The content is what we are interested in, when the user clicks
    save.

    Actual the save button is more a problem then a solution as wer'e not directly notice when it is clicked (we need to disable it).

    The actual implementation (set the callback in the options) is not convenient as in some typescript environments (like Angular
    Suneditor) the option is passed in a different scope. With that we had some trouble as we can't execute any of our class logic
    in this options object.

    In addition, it is not uniform, since the other event callbacks are registered in overwride a functions.

  • Possible solution:

    Provide a function that can be overridden by the user and get's called rifght after the save method.

    This could return the actual content - That's what the most users are interested in. This could prevent the need to listen for all
    changes when you are only interested in the "final content".

Thank's for your work! your editor is great :)
Greetings Daniel

JiHong88 added a commit that referenced this issue Jul 16, 2021
feature request: #811 onSave callback method
@JiHong88
Copy link
Owner

@DE-Danloc Currently the "callBackSave" option does this.
But I think the "onSave" event is more intuitive.
It will be applied in the next version.
Thank you for your contribution.

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

2 participants