0

CKEditor get value without html tags

asked 2022-11-28 17:47:40 +0800

softteam gravatar image softteam
130 1 8

Hi,

Is there a way to be able to get the value without html tags in CKEditor?

Thank you!

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-11-29 17:08:37 +0800

MDuchemin gravatar image MDuchemin
2490 1 6
ZK Team

Hi there,

That's not the default use case of CKEditor, since CKEditor is meant to returned formatted text. By retrieving the plain text value, you may not get "all of the data" from the editor widget.

This said, according to the CKEditor forums, the solution for this is to do editorInstance.document.getBody().getText() on the JS editor object.

In a ZK context, you'll have to add a few extra things around it: https://zkfiddle.org/sample/1bi71ub/1-ckeditor-retrieve-text

In this case I used the w:onChange client-side listener to retrieve and send the text value everytime "onChange" happens, but you could have any other wiring on this front. I also used a custom event listener onCustomRetrieveText to retrieve the text value in composer.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2022-11-28 17:47:40 +0800

Seen: 6 times

Last updated: Nov 29 '22

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More