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

suneditor can be attached to div? #1249

Closed
yashvi2026 opened this issue Jun 1, 2023 · 6 comments
Closed

suneditor can be attached to div? #1249

yashvi2026 opened this issue Jun 1, 2023 · 6 comments

Comments

@yashvi2026
Copy link

i wanted to attach editor to a div not textarea ,but when i do it gives a textarea with undefined content to edit

@JiHong88
Copy link
Owner

JiHong88 commented Jun 2, 2023

"div" is also possible.
Just create it the same way as "textarea".

@yashvi2026
Copy link
Author

yashvi2026 commented Jun 2, 2023

but it creates a textarea with undefined contents
this hii div is not displayed
<div id="hy">hiiiiiiiiiii</div>
const editor = SUNEDITOR.create("hy", {
mode: "balloon",
buttonList: [["fontColor", "hiliteColor", "textStyle"]]
});

@JiHong88
Copy link
Owner

JiHong88 commented Jun 2, 2023

You can use the value option.

const editor = SUNEDITOR.create("hy", {
value: "hiiiiiiiii", // or HTML string
mode: "balloon",
buttonList: [["fontColor", "hiliteColor", "textStyle"]]
});

@yashvi2026
Copy link
Author

yashvi2026 commented Jun 2, 2023

do i have to get the contents from the div when it is clicked and set to the value?

@JiHong88
Copy link
Owner

JiHong88 commented Jun 2, 2023

Yes, it is.
In the next version, I'll change it to get the contents of the div as well.

@JiHong88 JiHong88 added this to the 2.45.0 milestone Jun 2, 2023
JiHong88 added a commit that referenced this issue Jun 16, 2023
@JiHong88
Copy link
Owner

The 2.45.0 version has been updated.
Thank you.

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