Permalink
Browse files

fixed removeInstance bug: r is an instance of nicEditorInstance( or n…

…icEditorIFrameInstance), it doesn't have the removeInstance and removePanel methods
  • Loading branch information...
Danish Khan
Danish Khan committed Sep 28, 2010
1 parent efa6a1e commit eb2a83364dca35b637982546539bdca9865f9cb6
Showing with 1 addition and 1 deletion.
  1. +1 −1 nicEdit.js
View
@@ -296,7 +296,7 @@ var nicEditors = {
var editors = nicEditors.editors;
for(var i=0;i<editors.length;i++) {
if(editors[i].instanceById(e)) {
- return editors[i].instanceById(e);
+ return editors[i]; // r is an instance of nicEditorInstance therefore it does not have removeInstance or removePanel methods
}
}
}

7 comments on commit eb2a833

@nebulous

This comment has been minimized.

Show comment Hide comment
@nebulous

nebulous Jan 25, 2012

This breaks niceEditors.findEditor('someTextAreaID') which is the documented way to get a specific instance. Perhaps it was intended to go elsewhere?

This breaks niceEditors.findEditor('someTextAreaID') which is the documented way to get a specific instance. Perhaps it was intended to go elsewhere?

@danishkhan

This comment has been minimized.

Show comment Hide comment
@danishkhan

danishkhan Jan 25, 2012

Owner

Interesting I didn't run into that issues. So you are saying that it should be reverted and that using the editors[i].instanceById(e) will have removeInstance and removePanel?

Owner

danishkhan replied Jan 25, 2012

Interesting I didn't run into that issues. So you are saying that it should be reverted and that using the editors[i].instanceById(e) will have removeInstance and removePanel?

@nebulous

This comment has been minimized.

Show comment Hide comment
@nebulous

nebulous Jan 25, 2012

Perhaps there's a conflict here: I needed access to getContent() which is only available from the instance as returned by editors[i].instanceById(e) but remove(Instance|Panel) are only available by using editors[i]

upon cursory review it appears to be the difference between a nicEditorInstance and nicEditor (where according to the original documentation it would seem that a nicEditorInstance is what is expected to be returned)

Perhaps there's a conflict here: I needed access to getContent() which is only available from the instance as returned by editors[i].instanceById(e) but remove(Instance|Panel) are only available by using editors[i]

upon cursory review it appears to be the difference between a nicEditorInstance and nicEditor (where according to the original documentation it would seem that a nicEditorInstance is what is expected to be returned)

@victorbstan

This comment has been minimized.

Show comment Hide comment
@victorbstan

victorbstan Apr 5, 2012

Running into the same problem... update: two ways to get at the editor, save an instance in a variable when you initialize it and second, use the findEditor function.

Running into the same problem... update: two ways to get at the editor, save an instance in a variable when you initialize it and second, use the findEditor function.

@matthiaz

This comment has been minimized.

Show comment Hide comment
@matthiaz

matthiaz May 7, 2015

For anyone in 2015 that is still looking for this problem

try:

var nic     = new nicEditor({fullPanel : true});
var nicinstance= nic.nicInstances[0];
nicinstance.setContent('wwoot')
nicinstance.getContent()

That works for me.

For anyone in 2015 that is still looking for this problem

try:

var nic     = new nicEditor({fullPanel : true});
var nicinstance= nic.nicInstances[0];
nicinstance.setContent('wwoot')
nicinstance.getContent()

That works for me.

@firedranzer

This comment has been minimized.

Show comment Hide comment
@firedranzer

firedranzer Mar 25, 2017

Hey @matthiaz where to make these changes in nicedit.js file. I'm facing the removeinstance bug in my web-app.

firedranzer replied Mar 25, 2017

Hey @matthiaz where to make these changes in nicedit.js file. I'm facing the removeinstance bug in my web-app.

@matthiaz

This comment has been minimized.

Show comment Hide comment
@matthiaz

matthiaz Mar 27, 2017

@rpz-harode You don't make those changes in the nicedit.js file, you make them where you attach nicEditor to your textarea.

@rpz-harode You don't make those changes in the nicedit.js file, you make them where you attach nicEditor to your textarea.

Please sign in to comment.