Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8186357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:10:15+00:00 2026-06-07T02:10:15+00:00

I am working on a WYSIWYG editor. As it has to include just some

  • 0

I am working on a WYSIWYG editor. As it has to include just some basic functions I want to do it myself and avoid problems. Now it is working perfectly but I want to add a functionality in order to unbold, unitalic…

I know that with execCommand it is an automatic thing, but it does not work in the same way in all browsers so… my idea was the next: When pressing BOLD button, check the environment of the string, and…

  • If the selection is Between the open and close <b> tags, like <b>ab||selected||cd</b> replace selected with </b>selected<b>.
  • If the selection starts or finishes with the <b> tag, like <b>ab||selected||</b> replace it by </b>selected<b> (and then strip out all <b></b> groups.)
  • If the selection starts and finishes with the <b> tag, like <b>||selected||</b> replace it by </b>selected<b> (and then strip out all <b></b> groups.)

But… how can I get into a var the <b>content</b> string when just having the caret/selection IN content? It might be possible…

UPDATE
It is curious that the replacement is always the same. So, should I really get what I am asking for, or just replace it in this way, always?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T02:10:16+00:00Added an answer on June 7, 2026 at 2:10 am

    I am working on a WYSIWYG editor. As it has to include just some basic
    functions I want to do it myself and avoid problems. Now it is working
    perfectly but I want to add a functionality in order to unbold,
    unitalic…

    Do not write your own WYSIWYG editor.

    Do you really want to “avoid problems”? Then use one of existing good editors (there’re only 2… maybe 3 in fact). Creating editor is extremely hard task for which you need a lot of time (I mean… few years), a lot of knowledge and patience (a lot of too :P).

    I can myself write that “I am working on a WYSIWYG editor”. For more than half of the year I’m a core developer of one of these “good editors”. And during this period I implemented only one feature – very important and very complex, but one of tens/hundreds of them.

    That problem you have… I don’t even want to start answering. It sounds like a piece of cake, but it isn’t. It’s a piece of brick that can kill you when fall on your head :). I’ll only start enumerating important parts of the impl: Selection + range implementations, because native differ and are buggy (~5k LOC + min Nk LOC for tests). Then you need the proper styles handling (applying and removing) impl (min 1k LOC + tests), because you have to take care about styles spanning on many blocks (like entire table bolded) and different selections containing parts or entire styles etc. And you have to avoid native execCommand, because they will break your content. Then you should also think about updating toolbar buttons states and, to make your impl bullet proof, handling different style tags (e.g. pasted). And that’s only the tip of an iceberg – you’ll have styles handling, but hundreds of other things broken. Things that big editors have fixed.

    Anyway – learn config options for one of main editors and customize it as you want. This will take you a few hours, not a few years.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently using Firefox 7.0.1. I've been working on a WYSIWYG editor and just
I just came across RedActor (http://redactorjs.com/), a WYSIWYG-editor. I want to use it in
So, I'm working on a WYSIWYG editor with an already setup Grammar, etc. I've
I am trying to avoid hard-coding each instance of this WYSIWYG editor so I
I have a working rails 3.1 application that uses the mercury wysiwyg editor, however
I am working on implementing a spell check function for a web-based WYSIWYG editor.
I have a WYSIWYG editor working in all browsers except IE (all versions). I
I need to build a wysiwyg editor for a project I am working on
I have been working on a WPF Application that is essentially a WYSIWYG editor,
This is a code for a WYSIWYG text editor I am working on. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.