[kupu-checkins] r34308 - in kupu/branch/kupu-1.3: common plone plone/kupu_plone_layer
duncan at codespeak.net
duncan at codespeak.net
Tue Nov 7 11:10:50 CET 2006
Author: duncan
Date: Tue Nov 7 11:10:48 2006
New Revision: 34308
Modified:
kupu/branch/kupu-1.3/common/kupubasetools.js
kupu/branch/kupu-1.3/common/kupueditor.js
kupu/branch/kupu-1.3/common/kupusourceedit.js
kupu/branch/kupu-1.3/plone/body.kupu
kupu/branch/kupu-1.3/plone/kupu_plone_layer/kupu_wysiwyg_support.html
Log:
Fixes to source edit for IE7: added a div round the iframe/textarea combination which stops the textarea being displaced horizontally, but which broke zoom mode. Fixed zoom mode to use the containing div position which coincidentally simplifies the code. Tidy up html a bit for source view mode.
Modified: kupu/branch/kupu-1.3/common/kupubasetools.js
==============================================================================
--- kupu/branch/kupu-1.3/common/kupubasetools.js (original)
+++ kupu/branch/kupu-1.3/common/kupubasetools.js Tue Nov 7 11:10:48 2006
@@ -2554,10 +2554,8 @@
var height = document.body.offsetHeight-5;
}
width = width + 'px';
- var offset = iframe.offsetTop;
- if (sourceArea && sourceArea.offsetTop) offset = sourceArea.offsetTop-1;
- var nheight = Math.max(height - offset -1/*top border*/, 10);
- nheight = nheight + 'px';
+ var offset = iframe.parentNode.offsetTop;
+ var nheight = Math.max(height - offset -1/*top border*/, 10) + 'px';
fulleditor.style.width = width; /*IE needs this*/
iframe.style.width = width;
iframe.style.height = nheight;
Modified: kupu/branch/kupu-1.3/common/kupueditor.js
==============================================================================
--- kupu/branch/kupu-1.3/common/kupueditor.js (original)
+++ kupu/branch/kupu-1.3/common/kupueditor.js Tue Nov 7 11:10:48 2006
@@ -618,7 +618,7 @@
for (var i = 0; i < bodies.length; i++) {
data += Sarissa.serialize(bodies[i]);
}
- return this.escapeEntities(data);
+ return this.layoutsource(this.escapeEntities(data));
};
this.getHTMLBody = function() {
@@ -629,7 +629,7 @@
for (var i = 0; i < bodies.length; i++) {
data += bodies[i].innerHTML;
}
- return this.escapeEntities(data);
+ return this.layoutsource(this.escapeEntities(data));
};
// If we have multiple bodies this needs to remove the extras.
@@ -747,6 +747,13 @@
return contents;
};
+ this.layoutsource = function(data) {
+ data = data.replace(
+ /\s*(<(p|div|h.|ul|ol|dl|menu|dir|pre|blockquote|address|center|table|thead|tbody|tfoot|tr|th|td))\b/ig, '\n$1');
+ data = data.replace(
+ /\s*(<\/(p|div|h.|ul|ol|dl|menu|dir|pre|blockquote|address|center|table|thead|tbody|tfoot|tr|th|td)>)\s*/ig, '$1\n');
+ return data.strip();
+ }
this.escapeEntities = function(xml) {
// XXX: temporarily disabled
return xml;
Modified: kupu/branch/kupu-1.3/common/kupusourceedit.js
==============================================================================
--- kupu/branch/kupu-1.3/common/kupusourceedit.js (original)
+++ kupu/branch/kupu-1.3/common/kupusourceedit.js Tue Nov 7 11:10:48 2006
@@ -75,7 +75,7 @@
} else {
data = kupu.getHTMLBody();
};
- sourcearea.value = data;
+ sourcearea.value = data.strip();
kupu.setClass(sourceClass);
editorframe.style.display = 'none';
sourcearea.style.display = 'block';
Modified: kupu/branch/kupu-1.3/plone/body.kupu
==============================================================================
--- kupu/branch/kupu-1.3/plone/body.kupu (original)
+++ kupu/branch/kupu-1.3/plone/body.kupu Tue Nov 7 11:10:48 2006
@@ -7,6 +7,7 @@
xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<kupu:id>$Id$</kupu:id>
<kupu:part name="editorframe"><script type="text/javascript">var focuscount = 0;</script>
+ <div>
<iframe class="kupu-editor-iframe"
frameborder="0"
src="emptypage"
@@ -63,6 +64,7 @@
rows rows|default;
cols cols|default;">
</textarea>
+ </div>
</kupu:part>
<kupu:part name="suppress-kupu">
Modified: kupu/branch/kupu-1.3/plone/kupu_plone_layer/kupu_wysiwyg_support.html
==============================================================================
--- kupu/branch/kupu-1.3/plone/kupu_plone_layer/kupu_wysiwyg_support.html (original)
+++ kupu/branch/kupu-1.3/plone/kupu_plone_layer/kupu_wysiwyg_support.html Tue Nov 7 11:10:48 2006
@@ -11,7 +11,7 @@
<!--$Id: sourceedit.kupu 25716 2006-04-12 10:07:19Z fschulze $-->
<!--$Id: sourceedit.kupu 9779 2005-03-15 11:34:47Z duncan $-->
<!--$Id: contextmenu.kupu 9520 2005-02-26 16:30:23Z duncan $-->
- <!--$Id: toolbar.kupu 27291 2006-05-16 17:15:27Z fschulze $-->
+ <!--$Id: toolbar.kupu 31005 2006-08-04 14:29:57Z duncan $-->
<!--$Id: toolboxes.kupu 16467 2005-08-25 11:08:10Z guido $-->
<!--$Id: colorchooser.kupu 9520 2005-02-26 16:30:23Z duncan $-->
<!--$Id: save.kupu 9520 2005-02-26 16:30:23Z duncan $-->
@@ -19,8 +19,8 @@
<!--$Id: include.kupu 9520 2005-02-26 16:30:23Z duncan $-->
<!--$Id: wire.kupu 23401 2006-02-16 13:47:33Z limi $-->
<!--$Id: head.kupu 21720 2006-01-05 15:59:25Z paul $-->
- <!--$Id: xmlconfig.kupu 30986 2006-08-04 11:38:46Z duncan $-->
- <!--$Id: body.kupu 27715 2006-05-26 10:35:22Z duncan $-->
+ <!--$Id: xmlconfig.kupu 31003 2006-08-04 14:19:13Z duncan $-->
+ <!--$Id: body.kupu 31003 2006-08-04 14:19:13Z duncan $-->
<!--$Id: toolbar.kupu 25716 2006-04-12 10:07:19Z fschulze $-->
<!--$Id: drawers.kupu 14546 2005-07-12 14:35:55Z duncan $-->
<!--$Id: beforeunload.kupu 14546 2005-07-12 14:35:55Z duncan $-->
@@ -349,6 +349,7 @@
</div>
<script type="text/javascript">var focuscount = 0;</script>
+ <div>
<iframe class="kupu-editor-iframe" frameborder="0" src="emptypage" onfocus="this.contentWindow.focus();" tal:define=" base here/absolute_url; posfactory python:base.find('/portal_factory/'); base python:posfactory > 0 and base[:posfactory+15] or base; base kupu_base_override|base;" tal:attributes="src string:${base}/emptypage; tabindex tabindex/next|nothing;">
</iframe>
<input type="hidden" name="text_format:default" value="text/html" tal:define="fieldName fieldName|inputname|nothing; val python:fieldName and 'text/html' or 'html'; fieldName python:test(fieldName, fieldName+'_', '') + 'text_format:default';" tal:attributes="name fieldName;value val;"/>
@@ -358,6 +359,7 @@
</tal:test>
<textarea cols="80" rows="25" tabindex="" class="kupu-editor-textarea" name="description" id="kupu-editor-textarea" tal:define="pss modules/Products/PythonScripts/standard; text_format python: getattr(here,'text_format','html'); is_stx python:text_format=='structured-text'; is_ptx python:text_format=='plain';" tal:condition="not:fieldName|nothing" tal:content="python:(is_stx and pss.structured_text(inputvalue)) or (is_ptx and pss.newline_to_br(inputvalue)) or inputvalue" tal:attributes="name inputname; onfocus onfocus|nothing; onblur onblur|nothing; tabindex tabindex|nothing; rows rows|default; cols cols|default;">
</textarea>
+ </div>
<div class="kupuoverride" tal:condition="python:exists('kupu_content') and len(kupu_content)==0" tal:define="floated widget/allow_file_upload | python:1;" tal:attributes="style python:test(floated, 'float:left;;', '');"><span class="discreet"><a class="forcekupu" href="#" i18n:translate="suppress-kupu" tal:attributes="href string:${request/URL0}?kupu.suppress=${fieldName};" title="reload current page without kupu">
Edit without visual editor
More information about the kupu-checkins
mailing list