EpicEditor icon indicating copy to clipboard operation
EpicEditor copied to clipboard

ctrl+b, ctrl+i, ctrl+u should add markdown syntax

Open jozydapozy opened this issue 10 years ago • 8 comments

Now, when selecting some text and pressing for example ctrl+b will make that text bold in the editable text area, which is confusing.

This: Select some text: hello --> press ctrl+b --> **hello** would make more sense, I think.

jozydapozy avatar Mar 26 '14 12:03 jozydapozy

Oh, huh. That's not our code that makes it bold. Must be a browser thing. Never thought to even try that combo since I didn't write anything for it. What browser makes it bold?

And, yes, that's the plan with markdown (and make it work for any parser). There's tickets for that, leaving this open for the weird bolding of text thing.

OscarGodson avatar Mar 28 '14 16:03 OscarGodson

It seems like it's the default behavior of a contenteditable field in (at least) Chrome and IE. Also applies to ctrl+u (underline) and ctrl+i (italics).

jozydapozy avatar Mar 28 '14 16:03 jozydapozy

It is very necessary when a large amount of text editing.

arsensokolov avatar Mar 30 '14 05:03 arsensokolov

http://www.w3.org/TR/2008/WD-html5-20080610/editing.html#execCommand

Seems like an overwritable method via contenteditable's commands API

zethussuen avatar Mar 30 '14 05:03 zethussuen

Would definitely need some work but I was playing around with this a little bit in jsbin

http://jsbin.com/hetoqule/1/edit?js,output

dadambickford avatar Apr 12 '14 20:04 dadambickford

@dadambickford I think they're talking about a behavior only on Windows (im guessing since I can't repro on OS X at all) that when you select text in a contenteditable and press ctrl+b it literally makes the text bold by wrapping it in bold tags. However, we want to block that behavior and instead allow a way to set what bold/italic/etc means and have it do what you're doing in your example.

Your example is awesome and it's something we've been planning on doing a long time. Could you put that in the wiki or something under "how to make WYSIWYG markdown buttons? And, if you have more time you could create a plugin to add markdown buttons! There's a bunch of tickets requesting this and @brennannovak recently pinged me on twitter asking how to do this.

OscarGodson avatar Apr 13 '14 16:04 OscarGodson

@OscarGodson right so I think that would just be like how we disabled the ctrl+s behavior with .preventDefault()?, and then hooking up the example to ctrl+b or a button like I was playing with. What would I need to make it into a compatible plugin?

dadambickford avatar Apr 13 '14 17:04 dadambickford

I wish this feature

weaming avatar Oct 03 '15 09:10 weaming