Martin A. Posted March 25, 2016 Posted March 25, 2016 While working on two auto-embedding plugins, I noticed there's no way to know which page/area/controller you're at when processing the embed, which means you could fill a signature with Youtube videos, or Google Docs (which is what I'm working on right now). You can't use \IPS\Text\Parser::$area, as that isn't set. And since the embedding is handled trough a AJAX call, you can't really look at \IPS\Request either. So right now there is no way (that I can see) to limit the usage of the auto embedding. I guess you'll know the editorLocation when "validateLink" is called in CKEDITOR.plugins.ipsautolink, so why not pass it along, and at least let us 3rd party devs use it. What I specifically need is for Google Docs to not parse in signatures. And another plugin I need to put in a spoiler when posted in topic, but not when it's in a profile field. If there is way to do that now, I'd like to know. Thanks.
Tom Irons Posted March 25, 2016 Posted March 25, 2016 You can use the dispatcher class to get what application, module, and controller that is currently being used. \IPS\Dispatcher::i()->application returns an application object \IPS\Dispatcher::i()->module returns an module object \IPS\Dispatcher::i()->controller simply returns the controller Hope that helps!
Martin A. Posted March 25, 2016 Author Posted March 25, 2016 That will return the app, module and controller where the AJAX call is going, which will always be core - system - editor.
Tom Irons Posted March 25, 2016 Posted March 25, 2016 Just add extra parameters to the ajax call, like current_app, current_module, current_controller. I do something very similar with my Jump To plugin.
Martin A. Posted March 25, 2016 Author Posted March 25, 2016 Did you read my post? I'm not making the calls, IPS is, with their CKEditor plugin 'ipsautolink'.
Tom Irons Posted March 25, 2016 Posted March 25, 2016 I did that's why I tried to help you. I'm not a JS person so I haven't looked into any of their code. Sorry for trying to help.
Martin A. Posted March 25, 2016 Author Posted March 25, 2016 No need to be sorry, I do appreciate your attempt to help out
BomAle Posted March 30, 2016 Posted March 30, 2016 i don't know if you have already check the header... this for example: $_SERVER['HTTP_REFERER'] this combined with \IPS\Http\Url::internal could permise you to have control to area if I not wrong $_SERVER['HTTP_X_REQUESTED_WITH'] +1 I guess you'll know the editorLocation when "validateLink" is called in CKEDITOR.plugins.ipsautolink, so why not pass it along, and at least let us 3rd party devs use it.
BomAle Posted March 30, 2016 Posted March 30, 2016 $area could be obtained by "extension" propriety defined on \IPS\Helpers\Form\Editor(...)->extension but on validateLink you could get the istance of editor?
Martin A. Posted March 30, 2016 Author Posted March 30, 2016 4 hours ago, BomAle said: i don't know if you have already check the header... this for example: $_SERVER['HTTP_REFERER'] this combined with \IPS\Http\Url::internal could permise you to have control to area if I not wrong $_SERVER['HTTP_X_REQUESTED_WITH'] +1 That is not a bad suggestion. Didn't know HTTP_REFERER was carried over on an AJAX request. Although you're not getting the true $area it's coming from, at least you know if it's a topic or not.
Martin A. Posted March 30, 2016 Author Posted March 30, 2016 That actually solved it, @BomAle, thanks! But that opened another can of worms. If the embedded iframe is really big, core.front.core.autoSizeIframe is causing the editor to snap back to the top when trying to scroll past it. Sometimes this is affecting the entire page too, making it impossible to scroll down to the "Save" button. http://screencast.com/t/UvF8b6o2pW8l Here's the HTML for it, after the link is pasted <iframe src="http://localhost/?app=core&module=system&controller=embed&url=https%3A%2F%2Flighterpack.com%2Fr%2Fbl37jr" data-controller="core.front.core.autoSizeIframe" scrolling="no" style="height: 2592px; overflow: hidden;"></iframe> That's coming from this, which is the stock iframe template. return \IPS\Theme::i()->getTemplate( 'embed', 'core', 'global' )->iframe( (string) \IPS\Http\Url::internal( 'app=core&module=system&controller=embed', 'front' )->setQueryString( 'url', (string) $url ) ); Once it's saved, everything's normal, and the iframe HTML is the same. Any ideas on this, @Rikki?
Martin A. Posted April 2, 2016 Author Posted April 2, 2016 Have the IPS devs stopped reading this forums, or what? Haven't seen a reply in any of these topics from any of you in weeks. Thought this was a forum where we could interact directly with you. Now it's just a public Contributor Chat.
bfarber Posted April 8, 2016 Posted April 8, 2016 What you are describing sounds like a general bug - you might need to submit a bug report with a reproducible test case.
Martin A. Posted April 8, 2016 Author Posted April 8, 2016 Thanks. https://invisionpower.com/4bugtrack/active-reports/4110-autosizeiframe-causes-flickering-when-embedded-media-is-a-long-page-r11103/ My suggestion to send the editor location is still standing, though.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.