Re: execCommand

Hey John,

the current editor of the ExecCommand spec is Simon Pieters (*@zcorpan*).

*ExecCommand IS NOT a viable way of creating a richtext editor* for almost
any usecase and hasn't been for the past 10-15 years. Many years of
developer lives have been wasted attempting to do so, which is why *we
added a huge warning to the beginning of the document* trying to ensure
that no one else wastes times trying to do that.

We have spent the past decade creating the alternative you are asking for.
Check out EditContext and Input Events. Input Events is already shipped in
all major browsers.

However, these provide quite foundational APIs and a lot of work has to be
done in JavaScript to create a viable editor. For most users who need a
custom JavaScript editor, I would personally recommend using one of the
existing editor libraries (like CKEditor 5 or ProseMirror)  and build their
editor on top of that.

On Mon, Aug 12, 2024 at 6:32 PM John Page <jdpsaratoga@gmail.com> wrote:

> Like many before me I have tried and largely failed to build a rich text
> editor in HTML.    I saw the paper by  Johannes Wilm
> <johannes@fiduswriter.org> trying to formally spec the execCommand
> method, and would like to add my thoughts on the subject.   I am
> assuming (hoping) this is the right place to do it.
>
> Firstly, it seems that using contentEditable and execCommand is the only
> current way to build a rich text editor (RTE) without heroic measures..
>  It seems to an outsider like me that execCommand is the API to
> contentEditable elements.    It is unspecified and deprecated, but it
> clearly should not be removed until some alternative is provided.   It is
> currently widely in use and removing it would break a lot of websites.
>
> Second, :   Rather than try and modify what exists, how about starting
> fresh with a  new HTML  element called , say, <editor>  .  It would be a
> block element a bit like <textarea> or a contentEditable <div>.
>
> The real difference is that the edit functions would be instance methods
> of the element, corresponding roughly to and replacing the execCommand
> calls.  I realize the specification of these methods would be tricky, but
> this approach allows a new fresh run at it without the concerns of backward
> compatibility.
>
> It should be completely controllable from JS so we can build our own
> buttons and controls which simply call the element's methods.
>
> It would be styled using standard CSS, including the elements added to the
> document in the editing process.
>
> Having beaten myself nearly senseless trying to do this myself, I would
> think such a new element would be warmly accepted by the developer
> community.  I would be more than happy to contribute in any way I can.
>
> Respectfully
> John Page
> jdpsaratoga@gmail.com
>
>
>
>
>

-- 
Johannes Wilm
Fidus Writer
http://www.fiduswriter.org

Received on Sunday, 8 September 2024 10:55:09 UTC