Benchmark Reviews Discussion Forum Right Header

Go Back Benchmark Reviews Discussion Forum > Software > Web Design & Development

Web Design & Development Discussion ranging from HTML to SEO, PHP to XML, and everything else inbetween.

Reply
Thread Tools Display Modes
#1
Unread 26th November 2008, 12:08 PM
Olin Coles's Avatar
Olin Coles Olin Coles is offline
Executive Editor
Join Date: Feb 2007
Posts: 2,951
Joomla 1.5 Pagebreak Inserts at Top: Solved

I've had a go at solving the issues with inserting pagebreaks in articles using Internet Explorer.
Currently, when you insert a pagebreak in IE it inserts it at the top of the document, not at the current caret position. In IE it's possible to drag the pagebreak to the correct location, but our client desired a uniform behaviour across all browsers so here goes....

In IE the editor loses focus and the selection when the "light-box" pops up prompting the page title, so we have to save and restore the current position before the insert. We can achieve this in tinyMCE using it's getBookmark and moveToBookmark methods.

We need to change two Joomla files.

First one, /administrator/components/com_content/admin.content.html.php

Find "function insertPagebreak()" and before the "var tag=" line add the following.

Code:
var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
var isOpera = window['opera'] && opera.buildNumber ? true : false;
var isRealIE = isMSIE && !isOpera;
if (isRealIE && window.parent.tinyMCE) {
window.parent.tinyMCE.selectedInstance.selection.m oveToBookmark(window.parent.pagebreak_bookmark);
}



Second file, /plugins/editors-xtd/pagebreak.php

Find "function onDisplay"

Between the "$doc=" and "$template=" lines add the following...


Code:
$js = "
var pagebreak_bookmark;
function prePagebreak(editor) {
if (typeof(window['tinyMCE']) == \"undefined\" ) return true;
var isMSIE = (navigator.appName == \"Microsoft Internet Explorer\");
var isOpera = window['opera'] && opera.buildNumber ? true : false;
var isRealIE = isMSIE && !isOpera;
if (!isRealIE) return true;
if (!tinyMCE) return true;
pagebreak_bookmark = tinyMCE.selectedInstance.selection.getBookmark();
var e = window.event;
return true;
}
";
$doc->addScriptDeclaration($js);



Then add the following before the "return $button" line.

Code:
$button->set('onclick', 'prePagebreak(\''.$name.'\');');



I'm very new to Joomla so there may be a better way of excluding the code from non-IE browsers, but this code does seem to work.

Cheers,
Allan McDaniels
__________________
You can follow Benchmark Reviews on Facebook and Twitter!
Reply With Quote
#2
Unread 4th May 2009, 02:04 PM
egrueda egrueda is offline
Bit
Join Date: May 2009
Posts: 1
It's been a time since you left this post, but anyway I wanted to let you know it's been really useful for me, now this "bug" is solved and I thank you so much.

Cheers from Spain, and thanks again
Reply With Quote
Sponsored links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Joomla content title to meta description and keywords Olin Coles Web Design & Development 0 29th December 2008 10:33 AM
JCE Not Working After Install - Solved Olin Coles Web Design & Development 0 25th November 2008 07:57 AM
Joomla JCE Insert Image Error Solved Olin Coles Web Design & Development 0 24th November 2008 10:36 PM
Change Joomla Search Word Limit Olin Coles Web Design & Development 3 12th March 2008 06:54 AM
nVRAID and GHOST *SOLVED* Magnum Operating Systems 0 28th November 2007 07:17 AM


All times are GMT -7. The time now is 09:16 AM.

Benchmark Reviews Discussion Forum
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Remove advertisements

Follow Benchmark Reviews on FacebookReceive Tweets from Benchmark Reviews on Twitter