Author: ben
Date: 2007-08-13 16:51:55 -0700 (Mon, 13 Aug 2007)
New Revision: 6041
Modified:
openlaszlo/branches/wafflecone/lps/components/incubator/rich-text/richtexteditarea.lzx
openlaszlo/branches/wafflecone/lps/components/incubator/rich-text/scrollrichedittext.lzx
Log:
Change 20070813-ben-W by [EMAIL PROTECTED] on 2007-08-13 16:40:21 PDT
in /Users/ben/src/svn/openlaszlo/branches/wafflecone
for http://svn.openlaszlo.org/openlaszlo/branches/wafflecone
Summary: Fix rich text edit area bug where clicking bold moved insertion point
New Features:
Bugs Fixed: LPP-4396 rich text editor: clicking bold moves insertion point
Technical Reviewer: bshine
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
This is an application of a patch submitted by Dan Stowell, reviewed and
committed by Ben Shine. The patch from dstowell had to be updated to be
legals-friendly.
Note that this change only works in swf, because the rich text editor
does not work in DHTML at all.
Release Notes:
Details:
Also fixes EM-1182.
However!
LPP-4489 "Richedittext: Can't change formatting before typing" is still
present.
So is LPP-4480 "Richedittext: Moving focus outside the text editor doesn't
clear selection."
and LPP-4481 "Richedittext: Text size 18 doesn't seem to do anything."
Tests:
http://localhost:8080/wafflecone/lps/components/incubator/rich-text/test/richtexteditarea-test.lzx?lzr=swf7
http://localhost:8080/wafflecone/lps/components/incubator/rich-text/test/richtexteditarea-test.lzx?lzr=swf8
Modified:
openlaszlo/branches/wafflecone/lps/components/incubator/rich-text/richtexteditarea.lzx
===================================================================
---
openlaszlo/branches/wafflecone/lps/components/incubator/rich-text/richtexteditarea.lzx
2007-08-13 23:29:22 UTC (rev 6040)
+++
openlaszlo/branches/wafflecone/lps/components/incubator/rich-text/richtexteditarea.lzx
2007-08-13 23:51:55 UTC (rev 6041)
@@ -4,7 +4,53 @@
-->
<library>
<include href="scrollrichedittext.lzx"/>
-
+
+
+
+ <!--
+ This is a fix for EM-1129 and LPP-4396: clicking bold moves the insertion
+ point. We need to store the selection before losing the selection to
+ another view. [bshine 2007.08.13]
+ -->
+ <script><![CDATA[
+ LzModeManager.rawMouseEvent = function ( eName ) {
+ //Debug.warn("rawmouseevent %w", eName);
+ //assume this happens before handleMouseEvent though order is
+ //not guaranteed
+
+ // Store the selection in the currently focused text editor
+ // (if any). Useful for restoring a text field's selection
+ // after a click event.
+ var focus = Selection.getFocus();
+ if (focus) {
+ // Debug.info("got focus: %w", focus);
+ // focus is a path string - we have to eval() it to get
+ // an actual movieclip
+ var textclip = eval(focus); // apologies - dstowell
+ // [NB dstowell] __LZrte is a field I created to
+ // store a reference to a rich text editor view
+ // in the textclip itself. This field is _not_ part
+ // of the LFC.
+ if ("__LZrte" in textclip) {
+ // if we get here, it means that the focus is
+ // currently the rich text editor. Before
+ // we handle the mouse event, store the selection.
+ var beginIndex = Selection.getBeginIndex();
+ var endIndex = Selection.getEndIndex();
+ if (-1 != beginIndex && -1 != endIndex) {
+ textclip.__LZrte._ssel = beginIndex;
+ textclip.__LZrte._esel = endIndex;
+ }
+ }
+ }
+
+ this.clickStream.push( this.clstDict[ eName ] );
+ //call the cleanup delegate
+
+ this.callNext();
+ }
+ ]]></script>
+
<!---
A view which contains the text area for a rich text editor. Combine with a
richtexttoolbar to make an actual editor.
Modified:
openlaszlo/branches/wafflecone/lps/components/incubator/rich-text/scrollrichedittext.lzx
===================================================================
---
openlaszlo/branches/wafflecone/lps/components/incubator/rich-text/scrollrichedittext.lzx
2007-08-13 23:29:22 UTC (rev 6040)
+++
openlaszlo/branches/wafflecone/lps/components/incubator/rich-text/scrollrichedittext.lzx
2007-08-13 23:51:55 UTC (rev 6041)
@@ -86,6 +86,16 @@
<event name="onpos" />
<attribute name="pos" value="0" setter="this.setPos(pos)"/>
+
+ <method name="init">
+ super.init();
+ // Store a link to the enclosing rich text edit area deep in
this
+ // swf sprite, so that we can do a clever fix for LPP-4396,
+ // "clicking bold moves insertion point."
+ // See the LzModeManager.rawMouseEvent handler defined in
+ // richtexteditarea.lzx to see how we use this breadcrumb.
+ this.sprite.__LZtextclip.__LZrte = this.parent;
+ </method>
<!--- Set the scroll position and update the scrollbar to match
@param Number p: position-->
<method name="setPos" args="p">
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins