Search

This is still an issue. Here's a screenshot of the output that is taking place with extension.

Basic Input
Basic input

Basic Input (Code View)
Basic input - code view

XML Debug view image

As you will notice, the paragraph closing tag is getting pulled in next to the closing nested tag, and not wrapping the text it was originally wrapping around... for instance... it's input like this...

<p>This <b>is</b> a test.</p>

and it is being output like this…

<p>This <b>is</b></p> a test.

I have Symphony 2.3 installed and version 0.9 of the extension (the current version of the extension at the date of this post).

@bzerangue: based on your screenshots I now realize you were talking about the output and I can reproduce the issue. I will try to fix it asap!

@bzerangue: based on your screenshots I now realize you were talking about the output and I can reproduce the issue. I will try to fix it asap!

@remie - sorry that I was not clear in my first posts. Thank you so much for your help and for this wonderful extension!

I've replaced the tag formatter with a simple htmlentities() replacement in the Integration branch. This works in the back-end. In the front-end, the mode="formatted" version of the field will have the HTML entities escaped.

You can unescape it in your output using: <xsl:value-of select="field[@mode='formatted']" disable-output-escaping="yes" />

This will only work if your output is HTML. If you wish to use XHTML as your output, I'm afraid you'll have to wait until the kind folks at redactor JS adjust their source.

@remie, it looks as if the RedactorJS guys added in xhtml was an option (for backward compatibility)... look at the RedactorJS changelog in version 7.7

So it looks like if you turn on that option,

xhtml: true,

you will not need this php…

$string = $this->autoAdjustToXHTML($string);

UPDATE: It looks as if they may have removed the xhtml feature in version 8. I am not sure.

POSSIBLE SOLUTION

@remie -

This seems to work... without the htmlentities workaround.

I updated the formatter.redactor.php (around line 15)

function run($string){

        $string = str_replace('&nbsp;', '&#160;', $string);
        //$string = $this->autoAdjustToXHTML($string);

        $xhtmlstring = preg_replace('/<(img|hr|br|link|meta|input|param|base|area|meta)((s+w+(s*=s*("[^"]*"|'[^']*'|w+))?)*)s*>/', '<$1$2/>', $string);

        return $xhtmlstring;

    }

@bzerangue: the problem with this is that you do not check if the tag isn't closed using . Although this might be rare because the editor is pretty consistent, you can stil also edit the HTML yourself and for instance copy/paste HTML that has closed tags.

This regex will then turn

<img src="someimg"></img>

into

<img src="someimg" /></img>

which of course is invalid XML. We could say that the HTML edit option is an advanced feature, and if you use that you choose for the possibility of pasting invalid HTML....

Regarding the XHTML option: they have indeed removed it. I have a confirmation that they will update the code to output closed tags in the next version, however I do not know which version this will be.

I've implemented the regex in the Integration branch.

@remie - Thanks!!!

NOTE: I found that when I enter in an image like this… (via HTML Code View)

<img src="someimg"></img>

The RedactorJS Editor automatically changes it to… (which I click back to rich text view)

<img src="someimg">

mmm... that indeed seems to work. However, you can also press "Save" while in HTML code view. This will cause symphony to throw an error due to invalid XML.

I used a javascript html 2 xhtml parser:

http://ejohn.org/blog/pure-javascript-html-parser/

I call to the parser on onsubmit event of the form with the textarea value and seems that do the job. It's not the most polite soultion but works.

well, given the creator of the script at least one could expect that it works :)

@remie - can you merge the integration branch with the master? since the master doesn't work and integration does.

:)

Rich Text (Redactor) Text Formatter updated to version 1.0.0 on 28th of September 2012

Thank you!!!

Rich Text (Redactor) Text Formatter updated to version 1.1.0 on 30th of September 2012

@adamspruijt: version 1.1.0 has almost all RedactorJS options implemented, including additional languages, file & image upload, air mode and visual mode.

Rich Text (Redactor) Text Formatter updated to version 1.1.1 on 30th of September 2012

When trying to install I get:

mkdir() [function.mkdir]: Permission denied

What file needs to have it's permission set? I'm upgrading to Symphony 2.3 and getting rid of CKeditor for security reasons.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details