I have noticed a situation where unless TinyMCE is the default editor upon the page load, it's not saving the content.

Here is the situation:

I'm using NicEdit 0.9 as the default editor within the Filtered HTML input format selection. When a page first loads using this input format and editor, everything works fine when I save the drupal node. However, if I switch the input format to Tiny MCE and then save the drupal node, the content controlled by Tiny MCE does not get saved. In fact, it gets reverted to just "
".

Now, if I make the Full HTML input format selection default (which uses Tiny MCE as the default editor) then everything works fine ASSUMING I don't change the input format at all (even if I go from Tiny MCE to something else and back to Tiny MCE).

So it seems switching from any editor to Tiny MCE will cause it to fail saving the content.

Keep in mind, this is ONLY when changing the input format. If Tiny MCE is the editor that loads upon the initial page load, it works fine.

CommentFileSizeAuthor
#5 nicedit.js-1084248.patch299 bytestacituseu

Comments

twod’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: -default, -tinymce, -input format, -save, -fail

Do you see any JavaScript errors when switching back and forth between formats or when clicking "Enable/Disable rich-text"?
If you type something into TinyMCE and click "Disable rich-text" instead of submitting the form, does the source code look alright and up to date with the changes made in the editor?

jazzdrive3’s picture

I'm having this same problem. Things seemed to be working fine.

When it's basic content everything works fine. The problem comes when adding image tags. It seems adding to many of them is overloading it? If I add one image tag at a time and save between them, it seems to work fine. Strange.

hydrian’s picture

Issue tags: +wysiwyg, +tinymce, +input format

Make sure that your 'Input Format' definition allows all of the tags that your TinyMCE (or any other WYSIWYG editor) is generating. I know the <p> tag is used in almost all of them, but it is not part of any of the default Input Format definitions. This will cause drupal to strip any thing between those tags.

hydrian’s picture

Priority: Normal » Major

What version of TinyMCE are you running? I'm running 3.4.2. I'm having a similar problem. I fixed some of my issue by correcting the drupal core input filters. It seems that there is more to this though.

After doing some testing, I noticed that each time I enabled/disable rich-text, a new <input type="hidden" name="edit-body"> in being injected into the DOM. I would think these should have been overwritten not appended to. It looks like every time TinyMCE loads, it gets its data from the element that is named 'edit-body'. Since HTTP post/get only reads the first HTML input element of of a specified name, the other instances of this hidden input are ignored. This makes TinyMCE come up blank.

Recreation steps:

  1. load page with textarea that has the standard drupal textarea editor
  2. switch input format to a wysiwyg-tinymce enable input format
  3. type some data
  4. click 'disable rich-text'
  5. click 'enable rich-text'
  6. repeat 3-5 a few more times
  7. use firebug to search for the hidden <input> named edit-body
tacituseu’s picture

StatusFileSize
new299 bytes

Had same problem with CKEditor 3.5 for Full HTML and nicEdit 0.9 as default/Filtered HTML, the source of the problem is inside nicEdit.js (lib):

				var f = e.parentTag('FORM');
				if(f) { bkLib.addEvent( f, 'submit', this.saveContent.closure(this)); }

it registers onsubmit handler for form element, which will restore textarea's content to last one entered into nicEdit before disabling it/switching from it:

	saveContent : function() {
		if(this.copyElm || this.options.hasPanel) {
			this.ne.fireEvent('save',this);
			(this.copyElm) ? this.copyElm.value = this.getContent() : this.e.innerHTML = this.getContent();
		}	
	},

A 'needs work' (only Chrome tested) patch attached.

udane’s picture

I have the same problem. I am using wysiwys 6.x-2.2 and tinymce 3.3.9.
First of all, when I enter to edit a node, the default filter is always FilteredHtml, although I save it in full html or anyone else. Then, when I disable rich text, all img tags are stripped, although FilteredHtml supports img tags.
Is there any solution?

Thanks!

twod’s picture

@hydrian, yes, the editor will get the contents from the field named 'edit-body' since that's what Wysiwyg tells it do do. But those hidden input elements should not exist at all. I'm not sure why they are there or what creates them, but you should only see a textarea with the name 'edit-body'. Unless some module is manipulating the form... TinyMCE has no support for hidden input fields.

@tacituseu, This issue is for TinyMCE, if you're having similar problems with other editors please create new issues. If it happens with all of them somehting's most likely wrong with Wysiwyg itself, so one issue is enough. I'd consider the nicEdit problem a bug in nicEdit itself, as it'll happen regardless of whether Wysiwyg is used or not. The submit event handler should be removed so that nicEdit isn't invoked at all when the form is submitted and it's not active. We already do the same thing for a few other editors that don't have an official API call for removing the editor so even if this editor should be able to take care of it on its own, we can add that. Let's create a specific issue for that though.

@udane, Input format settings will not affect the editor's behavior. Input formats are only applied during rendering of the finished node.
Can you check if the browsers show any JavaScript errors? If there is an error when TinyMCE is detached it can not write the contents back to the original textarea.

tacituseu’s picture

Didn't mean to hijack, just had exactly the same problem with different editor for Full HTML, and hoped that OP can confirm with the patch attached that it is indeed nicEdit's fault and just change title/component.

Update: Issue for nicEdit #1132142: nicEdit doesn't remove its submit event handler

sun’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)
Issue tags: -wysiwyg, -tinymce, -input format

Sorry, without further information this issue can only be closed as not reproducible.

Feel free to re-open this issue if you want to provide further information. Thanks.