/    Sign up×
Community /Pin to ProfileBookmark

WYSIWYG Editor – Textarea, Div Editable or Iframe?

Hi,

I’m a new member this forum, and i have a issue.

I’m building a editor style WYSIWYG, and i’m doing the editable area…
When the user type a word, like int, this word receive a styling, for example, bold and color: blue.

But i’m with some troubles:

DIV Editable: Recently, i discover a div property : content Editable. It allow I edit the content of the div, like a textarea, but it continues with the properties of a div; … I tried replace the word searched, in this case ‘int’, e replace by formatted word. But when i do this, my cursor (caret) going to begin of the div (it should stay where the user typed that word…)… Troubles, troubles, troubles…

Textarea: Do not support css to single words, just for all text.

Iframe: Finally, i thought i saw a small light… Theorically, i can do it, because inside a frame has a HTML, that support “all things”… But, i can’t capture the ‘onkeydown’ event (and many others events). This way, i can’t control the new words that are typing.

The question is: What i do? What i use? Anyone know another object that do what i want? Anyone know how to fix above troubles?

Since yet, thanks!

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @richardaum spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...