pagedown icon indicating copy to clipboard operation
pagedown copied to clipboard

Prompt background does not disappear after 2nd try

Open GoogleCodeExporter opened this issue 9 years ago • 3 comments

When clicking the image button, the wmd-prompt-background appears. If the image 
insert is canceled using callback(null); in JavaScript, then the background 
disappears. However, if the user clicks the image button again, the 
wmd-prompt-background will appear again, but whether callback(null); or 
callback("http://someurlhere.com/photo.jpg"); is used, the background will not 
disappear.

The JavaScript Console shows at this time "Uncaught TypeError: Cannot call 
method 'removeChild' of null" in Markdown.Editor.js line 1684. 

I have attached the trace that the browser's console provides. The browser 
version is Google Chrome 20.0.1132.57 m on Windows XP.

Original issue reported on code.google.com by [email protected] on 25 Jul 2012 at 11:06

Attachments:

GoogleCodeExporter avatar Sep 12 '15 05:09 GoogleCodeExporter

Hmm, I can't reproduce this immediately. Are you sure the callback() call is 
asynchronous? If so, I'll need more details to reproduce this.

Original comment by [email protected] on 26 Jul 2012 at 4:12

GoogleCodeExporter avatar Sep 12 '15 05:09 GoogleCodeExporter

I have this problem occurring. Firefox 86.0.1

Firefox console:

Uncaught TypeError: background.parentNode is null                 Markdown.Editor.js:1760:17
    linkEnteredCallback https://website.../Markdown.Editor.js:1760
    <anonymous> https://website.../editor.js:57
    jQuery 9
        dispatch
        handle
        add
        sa
        each
        each
        sa
        on
        b
    <anonymous> https://website.../editor.js:55
    doLinkOrImage https://website.../Markdown.Editor.js:1804
    image https://website.../Markdown.Editor.js:1502
    bindCommand https://website.../Markdown.Editor.js:1441
    doClick https://website.../Markdown.Editor.js:1399
    onclick https://website.../Markdown.Editor.js:1425
    setupButton https://website.../Markdown.Editor.js:1421
    makeButton https://website.../Markdown.Editor.js:1472
    makeSpritedButtonRow https://website.../Markdown.Editor.js:1501
    UIManager https://website.../Markdown.Editor.js:1246
    run https://website.../Markdown.Editor.js:156
    <anonymous> https://website.../editor.js:78
    <anonymous> https://website.../editor.js:80

ProjectPatatoe avatar Mar 23 '21 02:03 ProjectPatatoe

Found a workaround

at Markdown.Editor.js:1760, remove background.parentNode.removeChild(background); and replace with background.remove();

This will break compatibility with IE, MDN has a polyfill available https://developer.mozilla.org/en-US/docs/Web/API/ChildNode/remove#polyfill but still does not work with IE and has the same error.

ProjectPatatoe avatar Mar 23 '21 03:03 ProjectPatatoe