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

Toolbar options only applied to first instance of an editor, second has "default" toolbar #533

Closed
xlthor opened this issue Oct 26, 2020 · 3 comments
Milestone

Comments

@xlthor
Copy link

xlthor commented Oct 26, 2020

Defining a toolbar like

const complexEditor = [
   	  
   	  ["bold", "underline", "italic", "strike", "subscript", "superscript"],
   	  ["font", "fontSize", "formatBlock", "lineHeight"],
   	  ["removeFormat"],
   	  ["fontColor", "hiliteColor"],
   	  ["outdent", "indent"],
   	  ["align", "horizontalRule", "list", "table"],
   	  ["link", "image", "video" ],
   	  ["undo", "redo"],
   	  [':i-More Misc-default.more_vertical', "showBlocks", "codeView", "preview", "fullScreen"],

   	  // (widthof view port (!): 1295)
         ['%1295', [
   		  [':t-More Text-default.more_text', "bold", "underline", "italic", "strike", "subscript", "superscript", "fontColor", "hiliteColor"],
   		  [':p-More Paragraph-default.more_paragraph', "font", "fontSize", "formatBlock", "lineHeight"],
   		  ["removeFormat"],
   		  ["outdent", "indent"],
   		  ["align", "horizontalRule", "list", "table"],
   		  ["link", "image", "video" ],
   		  [':i-More Misc-default.more_vertical', "showBlocks", "codeView", "preview", "fullScreen", "undo", "redo"],
   	  ]],
     ];

and assigning that to two different instances of the editor will only work on the first instance. Second instance has the default toolbar:

<SunEditor 
					lang={loc}
					setOptions={{
				    	height: 280,
						buttonList: complexEditor,
						videoFileInput: false,
						imageFileInput: false,
					}}
					setContents={this.state.values.collectiontext}
					placeholder={<ModLocales translate={"Type any content here ..."}/>}
					onChange={this.onPageEditorChange}
			  />

<SunEditor 
					lang={loc}
					setOptions={{
				    	height: 280,
						buttonList: complexEditor,
						videoFileInput: false,
						imageFileInput: false,
					}}
					setContents={this.state.values.collectionfooter}
					placeholder={<ModLocales translate={"Type any content here ..."}/>}
					onChange={this.onFooterEditorChange}
			  />

Screenshot:
grafik

@JiHong88 JiHong88 added this to the 2.34.1 milestone Oct 28, 2020
@JiHong88
Copy link
Owner

Hi,
This issue will be fixed in the next version.
In the current version, create a separate object for the button list.

const complexEditor = [...]
const complexEditor2 = [...]

@JiHong88
Copy link
Owner

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

@xlthor
Copy link
Author

xlthor commented Nov 2, 2020

Works now, many thanks!

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

No branches or pull requests

2 participants