Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1069 2012-09-08 07:36:39

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 619
Website

Re: hak_tinymce WYSIWYG article editor

Gocom wrote:

Normally you shouldn’t have to (and shouldn’t) convert it pack to a string representation. But if you do must, you can use the html method of jQuery. E.g.

Hi a new day and good weekend!
first thank you for being our guardian angel ;)

Now I can’t seems to understand how to work with your code, since it creates an object not a regular string/element as I’m used to work with.

This doesn’t work for me, as the image object/element doesn’t have any HTML inside it, it’s a self-closing tag.

images_list += $('<img alt="" />').attr('src', image_url[0]).html();

That’s why I used “outerHTML” to get the tag itself instead of what’s inside it which is nothing.
What am I missing please?

Sorry Patrick for spamming your topic.

Offline

#1070 2012-09-08 09:17:27

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: hak_tinymce WYSIWYG article editor

THE BLUE DRAGON wrote:

That’s why I used “outerHTML”

You could use it, but while outerHTML today works in all major browser, it’s not a standard. Firefox didn’t support it until v11.

instead of what’s inside it which is nothing.

That’s good point. In which case you can wrap it into a container and get it’s content. Like so:

$('<img alt="" />').attr('src', image_url[0]).wrap('<div />').parent().html()

Which gives you:

(string) <img src="/some/path.png" alt="" [/]>

To sanitize single values in jQuery (which you then can freely use in HTML), you could use text and html methods. E.g.

$('<div />').text('/some/path/or/user/<input>/.png').html();

The text() method sanitizes and the html() returns sanitized contents. This gives you a properly sanitized string:

/some/path/or/user/&lt;input&gt;/.png

Offline

#1071 2012-09-08 12:24:21

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 619
Website

Re: hak_tinymce WYSIWYG article editor

Gocom wrote:

That’s good point. In which case you can wrap it into a container and get it’s content. Like so:

Sweet :P
I changed that line in my code.

Offline

#1072 2012-09-13 21:39:05

asmodi
New Member
Registered: 2012-09-13
Posts: 4

Re: hak_tinymce WYSIWYG article editor

Hi,

I’m trying to get <txp:*> tags to work together with TinyMCE. I tried:

extended_valid_elements:"txp*[*]",
custom_elements:"txp:\\S+",

But to no avail (they get stripped out). Also this won’t help me when I want to put <txp:site_url /> in the href attribute on a link. I’m thinking about doing a TinyMCE extension to solve these problems, but does anybody have a simpler answer?

Last edited by asmodi (2012-09-13 21:39:32)

Offline

#1073 2012-09-13 21:53:34

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

Re: hak_tinymce WYSIWYG article editor

it’s sort of round hole square peg issue. TinyMCE does not like the xml style tags very much. event then I doubt it would allow tags as attributes as that is completely invalid. I’ve thought of doing some conversion from say <txp:*> to [txp:*] or something but haven’t found anything I really like.

as far as site_url is concerned that is fed to the tiny_mce initialization as the document_base_url so you can leverage that to get urls how you want

I’ve been wanting to see if I can do anything with the protect option but I’m not sure what the visual feedback should be for tags either, should you just see the tag? What would make sense?

I’m actually doing a bunch of tinyMCE cleanup cosing at the moment at work so I’m hoping I can get some new ideas as I become more intimate with it.

Last edited by hakjoon (2012-09-13 21:54:39)


Shoving is the answer – pusher robot

Offline

#1074 2012-09-13 22:26:55

asmodi
New Member
Registered: 2012-09-13
Posts: 4

Re: hak_tinymce WYSIWYG article editor

Thanks for the document_base_url tip, that solves half my problem…

If you ask me, the simplest answer is to have <txp:*> tags show up exactly as they are written (breaking the WYSIWYG model). You could also have them show up as some txp-themed icon, which would use a prompt to make changes.

For things like <txp:image />, would it be possible to have them show up the same as HTML image tags? This would probably involve AJAX calls to the Textpattern engine… wishful thinking, maybe. Ha ha!

Offline

#1075 2012-09-22 03:46:48

fastasleep
Member
Registered: 2008-06-17
Posts: 10

Re: hak_tinymce WYSIWYG article editor

Any chance you’ve had to look at this? I can’t figure it out. I am guessing wet_parachute is watching for alterations to the textareas and the TinyMCE initialization is triggering that, but I have no idea how to prevent it from happening. :)

hakjoon wrote:

@fastasleep: It’s possible that the initialization that tinyMCE does is triggering whatever wet_parachute is looking for. I’ll have to look into what it is doing in order to diagnose. I’m not really familiar with it.

Offline

#1076 2012-09-23 01:50:12

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

Re: hak_tinymce WYSIWYG article editor

Haven’t been able to figure out a way to prevent it. There seems to be some differences in line endings on how tinymce copies the content back into the textarea that causes the MD5 that is being generated to be different. Not sure how to go about normalizing it.


Shoving is the answer – pusher robot

Offline

#1077 2012-10-05 18:03:03

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,323
Website Mastodon

Re: hak_tinymce WYSIWYG article editor

Patrick, may I suggest that the txpimage plugin saves the last selected image category into a cookie and restores it once the “Insert/edit image” popup is opened once again?

This would help people find their way around larger image collections.

Offline

#1078 2012-10-06 18:24:59

Quimbly
Member
Registered: 2012-07-12
Posts: 22

Re: hak_tinymce WYSIWYG article editor

Hello,
The Tiny MCE toolbars are not showing up when I’m using the content editor.

I have uninstalled and re-installed the plugin.

If I browse to the script, it displays the javascript: e.g. http://domain.com/textpattern/tiny_mce/tiny_mce.js

When I go to edit a new article, I change the “Use Textile” setting to “Leave text untouched”, but nothing happens. I still see no Tiny MCE.

I’ve set the “Path to tiny_mce script” setting correctly in the hak_tinymce extensions preferences page.

I’ve tried setting the default value for “Use Textile” to “Leave text untouched” in Admin > Preferences > Site Preferences.

Can’t seem to get it to work!

As far as I can see, the script is not loading on the page when viewing the source for the article editor page. There is reference to tiny_mce.js

Any help would be greatly appreciated!

Offline

#1079 2012-10-08 15:04:23

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

Re: hak_tinymce WYSIWYG article editor

Check that tiny_mce.js is actually loading by looking at Firebug or developer tools. You will probably also see a tinyCME is undefined or similar error in teh console if it is not loading properly.


Shoving is the answer – pusher robot

Offline

#1080 2012-10-09 03:15:10

Quimbly
Member
Registered: 2012-07-12
Posts: 22

Re: hak_tinymce WYSIWYG article editor

Sorry, there was an error in my previous post: tiny_mce.js is NOT loaded on the page. There is no reference to it when viewing the source code on the content editor page.

- Plugin installed properly and is active.
- All of the settings are visible when I Admin > Extensions > hak_tinymce
- No errors in the console when looking at the write-content page

Maybe I’m missing something obvious????

Offline

Board footer

Powered by FluxBB