question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Get editor instance by id / Get all editor instances

See original GitHub issue

Version

1.4.6

Test Environment

Mac OS, Version: 76.0.3809.100

I’m using jquery to centrally initialize all the editors on the page like shown in the code below

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<link rel="stylesheet" href="https://uicdn.toast.com/tui-editor/latest/tui-editor.css"></link>
<link rel="stylesheet" href="https://uicdn.toast.com/tui-editor/latest/tui-editor-contents.css"></link>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.33.0/codemirror.css"></link>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css"></link>
<script src="https://uicdn.toast.com/tui-editor/latest/tui-editor-Editor-full.js"></script>

<div id="editor_1" class="markdown-editor"></div>
<div id="editor_2" class="markdown-editor"></div>


<script language="JavaScript">
   $(document).ready(function () {
    $('.markdown-editor').each(function () {
        var element = $(this);
        var config = {
           el: element.get(0),
           initialEditType: 'wysiwyg',
           initialValue: element.val(),
           height: '300px'
         };
        var editor= new tui.Editor(config);
    });
});
</script>

The editors are initialised perfectly well and function fine. Now is there anyway (any method available) that I can get the tui-editor instance corresponding to the div with id = editor_2. …so that I can wire up some event on it?

Also, is there any method to get a list/array of all editor instances initialised on the page?

Thanks

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
seonim-ryucommented, Sep 6, 2019

@jaydeepk I understand! It would be nice to have a function like getInstanceById. I’ll consider adding this API and let you know when it’s decided. Thanks.

0reactions
BettyJJcommented, Feb 26, 2022

Is the getInstances method removed from the current version? How can we do this now?

Read more comments on GitHub >

github_iconTop Results From Across the Web

CKEditor 5 – get editor instances - Stack Overflow
It's possible to access the editor instance using the ckeditorInstance property which is available on the contenteditable element that CKEditor ...
Read more >
How can I get the editor instance? - Froala
Getting the editor instance can be done in JS inside the initialized event like below. var editor = new FroalaEditor('selector', { events: {...
Read more >
Retrieve CKEDITOR.editor instance by div's 'id' attribute
I'm a newbie with CkEditor 3.1, and trying to make it work in a Vaadin+GWT environment, which is more Java than javascript oriented....
Read more >
Get TinyMCE editor instance by element selector
Target the active editor. Get the element by the textarea tag id (so your text area tag will need an id if it...
Read more >
How to get the Class or Instance of a Custom Editor of a ...
Hi all, I'm working around to customize a context menu if you right-click on a game object in the hierarchy window, by using......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found