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 multiple text #26

Closed
dpqduong opened this issue Apr 8, 2018 · 4 comments
Closed

How to add multiple text #26

dpqduong opened this issue Apr 8, 2018 · 4 comments
Labels

Comments

@dpqduong
Copy link

dpqduong commented Apr 8, 2018

Version

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/1.6.7/fabric.js"></script>
--
  | <script type="text/javascript" src="https://cdn.rawgit.com/nhnent/tui.code-snippet/v1.2.5/dist/tui-code-snippet.js"></script>
  | <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
  | <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.3/FileSaver.min.js"></script>
  | <script type="text/javascript" src="https://cdn.rawgit.com/nhnent/tui.component.colorpicker/1.0.2/dist/colorpicker.min.js"></script>
  | <script type="text/javascript" src="https://nhnent.github.io/tui.image-editor/latest/dist/tui-image-editor.js"></script>

Development Environment

Windows 7, browser : Google Chrome

Current Behavior

// Write example code

imageEditor.loadImageFromURL('img/sampleImage.jpg', 'SampleImage').then(sizeValue => {
    console.log(sizeValue);
	imageEditor.addText('hello 1', {
        position: {
					x: 100,
					y: 100
				}
    });
    imageEditor.deactivateAll();

	imageEditor.addText('hello 2', {
        position: {
					x: 300,
					y: 300
				}
    });

    imageEditor.clearUndoStack();
});

Expected Behavior

I want add multiple text but error here

tui-image-editor.js:1795 Uncaught (in promise) The executing command state is locked.
execute @ tui-image-editor.js:1795
execute @ tui-image-editor.js:571
addText @ tui-image-editor.js:1062
imageEditor.loadImageFromURL.then.sizeValue @ service-basic.js:1063
Promise resolved (async)
(anonymous) @ service-basic.js:1053

Please help me. Thank you so much

@jinwoo-kim-nhn
Copy link
Contributor

jinwoo-kim-nhn commented Apr 13, 2018

@dpqduong We are analyzing this problem. We will notify you when the issue is resolved. thank you.

@jinwoo-kim-nhn
Copy link
Contributor

@dpqduong

  • Since the order of execution of comand must be guaranteed for history, other commands can not be executed consecutively during execution of one command.
  • It should be able to guarantee the sequential execution by using promise when executing continuous command.

@safiyabsetec
Copy link

safiyabsetec commented May 2, 2019

I am using your image editor plugin.I need to adddtext with multiple text.if i am adding text one text after then first text x and y moving somwwhere.If i have a single text and then click in editor first text alone also jumping.

@yayapipi
Copy link

yayapipi commented Apr 25, 2020

Here is an alternative solution:

 imageEditor.addText('init text', {
     styles: {
         fill: '#000',
         fontSize: 20,
         fontWeight: 'bold'
     },
    position: {
         x: 10,
         y: 10
     }
 }).then(objectProps => {
     console.log(objectProps.id);

>      **//Add Your Second Text Here**
>      **imageEditor.addText('init text 2');**

});

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

5 participants