First time here? Check out the FAQ!
4

Blockquote problem - wmd js editor
 

Hello.

I have noticed (in Chrome 19.0.1084.56 m) that blockquote functionality in wmd editor doesn't work as it should.

This is what is generated:

Blockquote

Blockquote> BlockquoteBlockquote

Blockquote

However, in Mozilla (13.0.1), it works!

Does any of you face similar problems? Do you have any suggestions?

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
alexandros.z's avatar
596
alexandros.z
asked 12 years ago
Evgeny's avatar
13.2k
Evgeny
updated 12 years ago

Comments

I do confirm the bug.

naavi's avatar naavi (12 years ago)
see more comments

1 Answer

3

Find this solution and verified it fixed this issue on Chrome (solution from http://meta.stackoverflow.com/users/159266/dipesh-kc): http://meta.stackoverflow.com/questions/63307/blockquote-glitch-in-editor-in-chrome-6-and-7

We need to fix the file: askbot/skins/common/media/js/wmd/wmd.js

    @@ -21,6 +21,7 @@ Attacklab.wmdBase = function(){


    // Used to work around some browser bugs where we can't use feature testing.
+   global.isChrome = /chrome/.test(nav.userAgent.toLowerCase());
    global.isIE = /msie/.test(nav.userAgent.toLowerCase());
    global.isIE_5or6 = /msie 6/.test(nav.userAgent.toLowerCase()) || /msie 5/.test(nav.userAgent.toLowerCase());
    global.isIE_7plus = global.isIE && !global.isIE_5or6;
@@ -1599,6 +1600,11 @@ util.prompt = function(text, defaultInputText, makeLinkMarkdown, dialogType){
        var regexText;
        var replacementText;

+        // workaround for broken blockquote under Chrome.
+        if (global.isChrome) {
+            "X".match(/()./)
+        }
+
        this.selection = this.selection.replace(/(^\n*)/, "");
        this.startTag = this.startTag + re.$1;
        this.selection = this.selection.replace(/(\n*$)/, "");

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
dajafa's avatar
41
dajafa
answered 12 years ago
link

Comments

Thank you! Applied this patch to the master branch.

Evgeny's avatar Evgeny (12 years ago)
see more comments