Looks good, Pablo.
-ben
On Apr 14, 2006, at 6:27 PM, Pablo Kang wrote:
> Change 41529 by [EMAIL PROTECTED] on 2006/04/14 18:24:11
>
> Rich text editor font combobox does not blank out after creating a
> link.
>
> Fixes:
> LPP-1880 - Rich text editor font combo box is blank after creating
> a link
>
> Technical reviewer:
> QA reviewer: none
> Doc reviewer: none
>
> Details:
> After creating a link, the onfocus event handler (in
> richtexteditarea.lzx) immediately invokes _caretmove(), a method
> that determines
> the selection point of the edit area. Because this happens
> immediately during
> focus, the edit area doesn't actually have an insertion point,
> which also means
> that _caretmove can't determine what the formatting of the text
> should be. This
> is the reason the font combobox's value is blank.
>
> The fix would be to wait an idle frame before calling _caretmove(),
> except that doesn't work for the case of linking because if you let
> _caremove()
> determine the format of the text, you lose all the text formatting
> for a link
> (i.e. blue underline).
>
> The two fixes that need to be applied here are:
>
> 1) wait an idle moment after focus comes back to richtexteditarea
> 2) ignore calling _caretmove onfocus after it returns from the link
> panel
>
> Applying these fixes, this is what onfocus should look like in
> richtexteditarea.lzx:
>
> <method event="onfocus" reference="_field"><![CDATA[
> this._fieldhasfocus = true;
> if (this._containsOnlyWhitespace()) {
> this.clearText(true);
> this._ssel = this._esel = 0;
> this.setSelection(0,0);
> this.inp.setDefaultFormat(this.currentformat);
> }
>
> if (this._ignorenextfocus) {
> this._ignorenextfocus = false;
> return;
> }
>
> if (this._shouldresettoolbar) {
> if (! this['_caretMoveDel']) {
> this._caretMoveDel = new LzDelegate(this,
> '_caretmove');
> }
>
> //------------------------------------------------------------
> // Let the caretmove method figure out how to make
> the
> formats
> // match. Need to wait an idle frame before calling
> // _caretmove() because caret focus hasn't been
> set in
> // richinput area yet.
>
> //------------------------------------------------------------
> LzIdle.callOnIdle(this._caretMoveDel);
>
> if ((! this.isHTML) && this._field.getSelectionSize
> () ==
> -1)
> {
> // Selection length of -1 means this field
> doesn't
> have focus.
> // _caretmove() handles this for HTML text
> only, not
> plain text
> delegateInitSelection();
> }
> }
> ]]></method>
>
> and what makelink should look like in linkdialog.lzx:
>
> <!--- makelink
> Assigns link and standard link formatting to text
> selected
> in the editor. -->
> <method name="makelink">
> var url = urlfield.getText();
> var fmt = this.editor.currentformat;
> fmt.url = url;
> fmt.color = blue;
> fmt.target = "_new";
> fmt.underline = true;
> this.editor.setCurrentFormat(fmt);
> var ncaratinsertpoint = this.editor.getAttribute
> ("_esel");
>
> // make sure that next onfocus, which will be
> triggered by
> doing setSelection here, is ignored by editor.
> this.editor._ignorenextfocus = true;
>
> this.editor.setSelection(ncaratinsertpoint,ncaratinsertpoint);
>
> this.hide();
> </method>
>
> Note the _ignorenextfocus.
> <changeset-41407.zip>
> _______________________________________________
> Laszlo-dev mailing list
> [email protected]
> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
benjamin shine
software engineer
[EMAIL PROTECTED]
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev