From: "Søren Pilgård" <fiskomaten@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: Musings on creating an HTML-based WYSIWYG mode
Date: Tue, 1 May 2018 21:00:09 +0200 [thread overview]
Message-ID: <CAGXii2a2RtWDi7piK54fFfA=LQ8ieK1sKJ16OBJH7e=0uStV1w@mail.gmail.com> (raw)
In-Reply-To: <m3y3h3tohw.fsf@gnus.org>
[-- Attachment #1: Type: text/plain, Size: 4345 bytes --]
On Tue, May 1, 2018 at 4:54 PM, Lars Ingebrigtsen <larsi@gnus.org> wrote:
> I'm not going to implement this any time soon, but I wondering how much
> work it would be to create a WYSIWYG mode for Emacs based on
> round-tripping through shr.
>
> I think most people who have approached this subject before have said
> "just use some text properties and store as enriched text and there you
> go", but it's just not sufficient: If you're writing a <ol> list, then
> you want this to be rendered as it should be, and it should be rendered
> as the recipient is likely to read the text. Otherwise it's not very
> WYSIWYG, is it?
>
> So: The serialisation format would be HTML. Whenever a user types
> something, Emacs generates HTML, asks shr to render it, and then present
> the user with the results. This would, of course, potentially be
> horrifically slow, but we could envision strategies to only re-render
> parts of the buffer/document.
>
> Let's say the user is typing away at something resembling this
> paragraph, and then decides to make "typing" bold, so the user would go
> back to that work, mark it and issue whatever command there is for "make
> this bold". The mode would do the change to the HTML document, ask shr
> to re-render it, and then display the results.
>
> This is, of course, not like what Emacs does normally when editing text,
> and would break a lot of invariants that people are used to. We can
> preserve basic things like point and mark easily enough (by inserting
> special constructs into the HTML that allows us to find and restore them
> after re-generating the buffer), but I'm sure there's oodles of stuff
> that will stop working with such a radical approach. But perhaps that's
> OK?
>
> Inserting images and the like into the buffer would be unproblematic --
> just add a few new dired commands like "copy image to WYSIWYG clipboard"
> and then yank from that "clipboard" into the buffer. This presents
> further interesting questions about the serialisation format... but we
> could, for instance, use MIME for that: multipart/related with the
> images stashed as cid: links.
>
> "External" images are simpler, of course.
>
> The WYSIWYG clipboard would also be necessary for when cutting and
> yanking text: If you're killing text starting from the middle of a link
> and ending up in the middle of an <ol> link, you have to ensure that you
> end up with something similar when you yank this mess somewhere else.
> And you have to ensure that everything remains valid around where you
> killed the region, too.
>
> And then there's always the interesting subject of tables, or rather:
> Side-by-side continuous regions. Making editing commands work in those
> circumstances may be, er, interesting...
>
> So here's what I think: I think somebody (i.e., me) should try
> implementing this. I think there are so many unknowns here that it's
> difficult to say whether this is a workable way of doing WYSIWYG in
> Emacs before you have something semi-working and get a grip on how this
> would feel in practice.
>
> But like I said, I don't have time at the moment. :-)
>
> --
> (domestic pets only, the antidote for overdose, milk.)
> bloggy blog: http://lars.ingebrigtsen.no
>
>
>
>
The question is if it is worth the effort?
To me the greatest benefit of a WYSIWYG editor would be if I could edit in
the "finished" website eg. sort of like editing the elements in the
developer tools of chrome/firefox. That means CSS has to be supported, and
potentially also javascript. If a website is only HTML it is easy enough
for me to visualize how it is going to look. Besides HTML rarely stands
alone now a day, it is most likely consumed by some tool and or combined
with CSS (or something compiled to CSS) and javascript (or something
compiled to javascript). And in a lot of cases i do not edit actual HTML
but some templating system complicating the issue even further.
I personally think something like skewer where a browser is updated to
reflect the current state is a lot more useful, though I havent found a way
to make it work fluidly when doing more complex backends.
Building a WYSIWYG editor in Emacs sounds like a complicated affair and I
am not sure it is really worth it as editing plain standalone HTML is
becoming a niche thing. It could be useful for HTML emails though!
[-- Attachment #2: Type: text/html, Size: 5319 bytes --]
next prev parent reply other threads:[~2018-05-01 19:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-01 14:54 Musings on creating an HTML-based WYSIWYG mode Lars Ingebrigtsen
2018-05-01 19:00 ` Søren Pilgård [this message]
2018-05-01 20:11 ` Lars Ingebrigtsen
2018-05-02 8:16 ` Søren Pilgård
2018-05-02 9:22 ` Joost Kremers
2018-05-02 9:36 ` Van L
2018-05-02 1:45 ` Stefan Monnier
2018-05-02 9:50 ` Lars Ingebrigtsen
2018-05-02 10:36 ` Yuri Khan
2018-05-02 10:43 ` Lars Ingebrigtsen
2018-05-02 10:49 ` Yuri Khan
2018-05-02 20:32 ` Michael Heerdegen
2018-05-02 3:11 ` Richard Stallman
2018-05-02 3:50 ` Van L
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAGXii2a2RtWDi7piK54fFfA=LQ8ieK1sKJ16OBJH7e=0uStV1w@mail.gmail.com' \
--to=fiskomaten@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.