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

How to add custom menu buttons #132

Closed
GEMI opened this issue Jan 22, 2019 · 26 comments
Closed

How to add custom menu buttons #132

GEMI opened this issue Jan 22, 2019 · 26 comments

Comments

@GEMI
Copy link

GEMI commented Jan 22, 2019

Version

3.4.0

Development Environment

Windows 10

Current Behavior

All menu buttons are predefined menu: ['crop', 'flip', 'rotate', 'draw', 'shape', 'text', 'filter'],

Question

How can I add custom menu buttons? For example 'save'?

@junghwan-park
Copy link
Member

@GEMI
Currently adding menu button or something functional into TOAST UI Image-Editor UI via Image-Editor constructor's options parameter or certain API is not available.

If you have to create save button and add that button among TOAST UI Image-Editor's menu buttons, you should extend TOAST UI Image-Editor src/ui/template/controls.js or just add a button into after Image-Editor rendered.

@arifhussain353
Copy link

arifhussain353 commented Feb 13, 2019

@GEMI
This is not a proper solution but you can do with JQuery or Javascript by replacing HTML on load. For example:

 $('.tui-image-editor-header-buttons .tui-image-editor-download-btn').
replaceWith('<button class="tui-image-editor-save-btn" >Save</button>')

Replace Download button into Save and then attach event with addEventListener

document.querySelector('.tui-image-editor-header-buttons .tui-image-editor-save-btn').
addEventListener('click', this.prcoessSaveImage)
fucntion prcoessSaveImage(){
//your code
}

@xiezm
Copy link

xiezm commented Apr 4, 2019

@arifhussain353

虽然你这种侵入性的方法很龊,更新以后的新版本,可能就不兼容了。
但是目前要想解决问题,还不得不这么做。
看不懂,你自己去翻译吧。

@sergeizhukov
Copy link

Yeah It should be able at least to rename standard buttons. Add a new one.

@KunalBurangi
Copy link

The download button opes a new tab . i don't want that new tab how to stop that ?

@ravizeewee
Copy link

@GEMI
Currently adding menu button or something functional into TOAST UI Image-Editor UI via Image-Editor constructor's options parameter or certain API is not available.

If you have to create save button and add that button among TOAST UI Image-Editor's menu buttons, you should extend TOAST UI Image-Editor src/ui/template/controls.js or just add a button into after Image-Editor rendered.

Can you show the example?

@stale
Copy link

stale bot commented Apr 4, 2020

This issue has been automatically marked as inactive because there hasn’t been much going on it lately. It is going to be closed after 7 days. Thanks!

@stale stale bot added the inactive label Apr 4, 2020
@stale
Copy link

stale bot commented Apr 11, 2020

This issue will be closed due to inactivity. Thanks for your contribution!

@stale stale bot closed this as completed Apr 11, 2020
@IrtazaHussain1
Copy link

Hi! I want to use the custom function on the download button is it possible and how can I do that

@praveenrsg
Copy link

I want to remove "Load" and "Download" Button and the header text
Please have a look on the marked area of the below image
image

@LemuelKL
Copy link

I want to remove "Load" and "Download" Button and the header text
Please have a look on the marked area of the below image
image

I removed the header all together by overriding the following CSS properties in my Vue project:
.tui-image-editor-header { display: none; } .tui-image-editor-container .tui-image-editor-main { top: 0; }

@vladsovetov
Copy link

vladsovetov commented Nov 13, 2020

I want to remove "Load" and "Download" Button and the header text
Please have a look on the marked area of the below image
image

Seems slightly cleaner solution

const myTheme = {
    "header.display": "none"
};
var instance = new ImageEditor(document.querySelector('#tui-image-editor'), {
     includeUI: {
         ...
         theme: myTheme,
         ...
     },
    ...
});

@singhkirtii
Copy link

Hi. I want to save the edited image (without downloading it to the local system) in a storage system (maybe S3) and then save the image URL in database. How can I do that?

@azakero
Copy link

azakero commented Feb 13, 2021

Hi. I want to save the edited image (without downloading it to the local system) in a storage system (maybe S3) and then save the image URL in database. How can I do that?

@singhkirtii I'm looking for this solution as well. Could you figure it out?

@singhkirtii
Copy link

Yes. You can fetch the image data using the editor's toDataURL() function. This data can also be converted into blob, if needed. Once you have the image data, you can send it to the server and then upload the dataURI/blob directly to S3.

@azakero
Copy link

azakero commented Feb 15, 2021

Thanks mate. Understood

@eriksetiadi-pro
Copy link

how do i can add 1 or more menu?
Screenshot_11

@vijaykuamrparelli
Copy link

git
How to add one more menu item inti list with submenus

@Shane-Geary
Copy link

Any suggestions on a React equivalent of this?

@lja1018
Copy link
Contributor

lja1018 commented Mar 10, 2022

@Shane-Geary
There is no way to add a menu yet. We will decide after a discussion with the team.

@PrashantNandanvar
Copy link

Screenshot from 2022-05-24 11-47-14
How can i use this theme using html

@lja1018
Copy link
Contributor

lja1018 commented Jun 10, 2022

@PrashantNandanvar
Menubar Position Top does not have a separate theme.
You can set the option by setting it to includeUI.menuBarPosition.top = 'top'.

@yuban00018
Copy link

Is there any way to stop the editor from popping up a new tab when I click the download button?

@lja1018
Copy link
Contributor

lja1018 commented Jul 14, 2022

@yuban00018
Would you like to use file-saver?

@shireennazneen
Copy link

const logImageContent = () => {
const instance = refImage.current.imageEditorInst;
let dataUrl = instance.toDataURL();
console.log(dataUrl)
};

and add button save and give the onClick ={logImageContent} you will get bs64 data of image and use it

@Breezewrf
Copy link

@Shane-Geary There is no way to add a menu yet. We will decide after a discussion with the team.

Hi,

Is there any solution?

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