Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setContents on an inline editor shows the toolbar #686

Closed
NickyTope opened this issue Mar 30, 2021 · 14 comments
Closed

setContents on an inline editor shows the toolbar #686

NickyTope opened this issue Mar 30, 2021 · 14 comments
Labels
Milestone

Comments

@NickyTope
Copy link
Contributor

Hi, I can't be certain which version this started in but when I call setContents on an inline editor it makes the toolbar show, is this behaviour expected?

I am using a toolbarContainer to show the toolbar above the title of the document in my app and the toolbar now hides the title on opening any existing document.

I have started manually calling toolbar.hide() to get around this but wanted to raise it as an issue.

This can easily be replicated by setting the mode of the ss editor to inline in suneditor_build_test.js

Great work on this editor btw, we love it!!

@JiHong88 JiHong88 added this to the 2.37.3 milestone Mar 30, 2021
@JiHong88 JiHong88 added the bug label Mar 30, 2021
@JiHong88
Copy link
Owner

The 2.37.3 version has been updated.
If this issue has not been resolved, please reopen this issue.
Thank you.

@NickyTope
Copy link
Contributor Author

Thanks for the quick update however unfortunately this still happens in 2.37.3.

Setting mode: 'inline' in the ss editor in the test still replicates this issue.

Not sure if this is intended (or new?) but setContents always seems to set focus at the end of the content, can we possibly add a parameter to specify if focus is needed? setContents(content, focus=true) or something similar?

I don't have permission to reopen this issue, happy to resubmit if needed?

@JiHong88
Copy link
Owner

JiHong88 commented Mar 31, 2021

Use the focus method.

editorInstance.setContents(content);
editorInstance.focus();

Um.. The issue is not reproduced.
http://suneditor.com/sample/html/examples.html#functions

@NickyTope
Copy link
Contributor Author

In my setup (and when I run the test locally) calling setContents automatically sets the focus, this is undesired.

You are correct however, this does not happen in the example page, I will try to recreate from a simple instance and get back to you, thanks for looking at this so quickly again!

@nuanda744
Copy link

I have the same problem. When I load the page it scrolls down to the editor if I use setContents...

@JiHong88
Copy link
Owner

@nuanda744 Are you using the latest version?
Please explain in detail how you did the test and the status.

@nuanda744
Copy link

I'm using the latest version (2.37.4) inside a form rendered by a Google Apps Script Web App. The editor is working well. The only problem is it gets focus (scrolling down in the page) as soon as I load the page.
This is the init:
SUNEDITOR.create('firma',{
font : [
'Arial', 'Courier New', 'Impact',
'Georgia','tahoma', 'Trebuchet MS', 'Verdana'
],
fontSize : [
8, 10, 14, 18, 24, 36
],
colorList: [
['#ccc', '#dedede', 'OrangeRed', 'Orange', 'RoyalBlue', 'SaddleBrown'],
['SlateGray', 'BurlyWood', 'DeepPink', 'FireBrick', 'Gold', 'SeaGreen']
],
width: '100%',
height : 'auto',
imageWidth : 150,
popupDisplay: 'local',
resizingBar: false,
buttonList : [
['bold', 'underline', 'italic', 'strike', 'formatBlock', 'font', 'fontSize',
'fontColor', 'hiliteColor'],
['link'],
['removeFormat', 'fullScreen', 'codeView', 'showBlocks']
],
});

@JiHong88
Copy link
Owner

JiHong88 commented Apr 10, 2021

@nuanda744 Are there any event functions in use?
This issue is not reproduced. :(

@nuanda744
Copy link

After the SUNEDITOR.create I only use editor.setContents(variable). The variable contains simple html code.
The code appear correctly rendered inside the editor. The only problem is that the textarea gets focus :-(

@JiHong88
Copy link
Owner

@nuanda744 If you delete editor.setContents(variable) code then is working nomally?

@nuanda744
Copy link

Yes. No focus problem without setContents...

@JiHong88
Copy link
Owner

@nuanda744 What is the test environment?

@JiHong88 JiHong88 modified the milestones: 2.37.3, 2.38.0 Apr 11, 2021
@JiHong88 JiHong88 reopened this Apr 11, 2021
@JiHong88
Copy link
Owner

@NickyTope @nuanda744
The 2.38.0 version has been updated.
If this issue has not been resolved, please reopen this issue.
Thank you.

@nuanda744
Copy link

Thank you so much JiHong, it works :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants