JiHong88 / suneditor

Pure javascript based WYSIWYG html editor, with no dependencies.
http://suneditor.com
MIT License
1.66k stars 307 forks source link

Weird HTML Input Element in Editor? #1377

Closed Disservin closed 2 months ago

Disservin commented 2 months ago

Describe the bug See your example on http://suneditor.com/sample/index.html. There seems to be a rogue html input at the bottom of the editor?

To Reproduce Steps to reproduce the behavior:

  1. Go to http://suneditor.com/sample/index.html

Expected behavior The input shouldn't be visible I think?

Screenshots image

Desktop (please complete the following information):

KonstantinosAng commented 2 months ago

+1. After upgrading to the new version, there is a weird input element. You can also see it in the suneditor playground:

http://suneditor.com/sample/html/options.html

melloware commented 2 months ago

For now I hid it with this CSS

/* Hide input but leave it accessible*/
body div.se-container > input {
    border: 0;
    padding: 0;
    margin: -1px;
    position: absolute;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    transform: scale(0);
}
Disservin commented 2 months ago

For now I hid it with this CSS

/* Hide input but leave it accessible*/
body div.se-container > input {
    border: 0;
    padding: 0;
    margin: -1px;
    position: absolute;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    transform: scale(0);
}

For me even display: none was enough..

davidkonrad commented 2 months ago

@JiHong88 @Disservin

Yes, but not a solution either. The real problem is in constructor.js, line 87:

const focusTemp = doc.createElement('INPUT');
        focusTemp.tabIndex = -1;
        focusTemp.style.width = '0 !important';
        focusTemp.style.height = '0 !important';

You cannot change width or height like that. Update style as attribute and get rid of the border as well :

focusTemp.setAttribute('style', 'width:0; height:0; border:none;');

will work.

Disservin commented 2 months ago

Yes, but not a solution either. The real problem is in constructor.js, line 87:

well ofc not 🤣 I just didn’t have the time to dive in the source. I think you can PR your change ?

melloware commented 2 months ago

@Disservin this can be closed it was release in 2.46.1

Disservin commented 2 months ago

lol the other person didn't see this issue and instead opened their own and i assume @JiHong88 also missed it :upside_down_face:

Disservin commented 2 months ago

fixed with https://github.com/JiHong88/suneditor/commit/c42468141cb5c5ee9cf203a539e1c1c98857699c