Jump to content

TinyMCE issue


pokmot
 Share

Recommended Posts

I already tried with "u" ... It doesn't work on my side.  

---

Now if I remove the first <p> in the regex it suddenly works even without "u" ! But then I got a broken p tag..

If this works for you, there must be something with my local installation, php or db? Would that make sense? I'm definately doing nothing wrong here, I checked so many times now.

Link to comment
Share on other sites

This is very interesting topic. I would love to see textformatter, which would take many of the most popular services (youtube, vimeo, slideshare etc) and do something similar than here.

I see adding videos from all the major services (YouTube & vimeo) as as commonplace nowadays as making text bold or inserting an image. I don't know why TinyMCE makes this so difficult. The media plugin is pretty much useless for this and I don't like modding the wire install of TinyMCE to do something so basic.

Regards

Marty

Link to comment
Share on other sites

Now if I remove the first <p> in the regex it suddenly works even without "u" ! But then I got a broken p tag..If this works for you, there must be something with my local installation, php or db? Would that make sense? I'm definately doing nothing wrong here, I checked so many times now.

The only thing I can guess here is that your version of PCRE doesn't have UTF-8 options bundled into it. I think this is one of those things that is not universally part of all PCRE installs, and I've found the PCRE version sometimes varies even on the same version of PHP.

Another route you could take would be to just match all non-word characters up till the http, like this:

$page->body = preg_replace("#<p>[^\w]*https://www.youtube.com/watch\?v=([^\s&<]+).*?</p>#i", $replacement, $page->body);

There isn't any reason why that shouldn't work, but I won't make any assumptions as these characters are clearly difficult to match and may be affected by the PCRE version since I can match them here but you can't there.

I see adding videos from all the major services (YouTube & vimeo) as as commonplace nowadays as making text bold or inserting an image.

Except that Youtube, Vimeo, Facebook, etc., are companies, not universal standards (though I'm sure they'd like you to think otherwise). :) Companies and their services come and go. My opinion is that anything tied to a company or specific outside service belongs as add-ons rather than native to PW or TinyMCE. So I think this would be a great idea for an add-on module for PW, something that knows how to recognize the URLs for major services and automatically inserts the proper iframe/embed code... sure would be convenient anyway.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...