W3C home > Mailing lists > Public > www-svg@w3.org > April 2004

Re: 3.2 Editable Text Fields

From: Fred P. <fprog26@hotmail.com>
Date: Thu, 29 Apr 2004 21:36:32 -0400
To: www-svg@w3.org
Message-ID: <BAY14-F7E0QRJxb3cRE0003dc3d@hotmail.com>


>How will editable text elements which have tspans and trefs be handled?
>For example:

>   <text editable="true">
>     Some <tspan fill="red">text</tspan>
>   </text>
>
>If the cursor is just before the "t" of "text", will subsequently typed
>characters be inserted at the fron of the tspan's text node of the end of
>the text's first text node?

If we follow the normal behavior on "Microsoft Word" that 99% people use:

Anything before t would be in default color (black?).
Clicking on the area just before t,  (i.e.  Some |text)  same behavior: 
default.
Selecting t, (i.e. Some [t]ext) the new text is in red and t is deleted.

Let say, we have:
<text fill='black' editable="true">Is <tspan 
fill="red">red</tspan>_cool?</text>

Having the cursor before r, the color is black
Having the cursor after d, the color is red
Having the cursor after _ the color is black

Now, if your cursor is before _, you press backspace 3 times, and type some 
text
that text is red (following word convention).

Now, if your cursor is after _, you press backspace 4 times, and type some 
text
that text is red (following word convention).

If you press backspace n times, move with arrows or click, the "red" context 
is lost.
(i.e. the <tspan> is dropped.)

Now, if your cursor is after _, you press backspace 4 times, and arrow 
right, type some text
that text is black (following word convention).

>   <text editable="true">
>     <tspan fill="red"/><tspan fill="green"/><tspan fill="blue"/>
>   </text>

All "empty" <tspan></tspan>  or <tspan/> are dropped.

So after parsing the following should exist:

   <text editable="true">
   </text>

>If characters are typed, what colour do they become?

If we use the drop convention which would make sense, default color - black.

>   <defs>
>     <text id="t">Referenced text</text>
>   </defs>
>   <text editable="true">
>     <tref xlink:href="#t"/>
>   </text>

If you edit, you should "copy" the text in the shadow DOM tree, that would 
make sense.

Therefore, once you start typing, the following exist:

[that means: tref with TEXT inside the tags, don't use the xlink:href value]

   <defs>
     <text id="t">Referenced text</text>
   </defs>
   <text editable="true">
     <tref xlink:href="#t">Referenced text</tref>
   </text>

OR

[another preferrable method - keep context]

   <defs>
     <text id="t">Referenced text</text>
   </defs>
   <text editable="true">
     <tspan xlink:href="#t">Referenced text</tspan>
   </text>

OR

   <defs>
     <text id="t">Referenced text</text>
   </defs>
   <text editable="true">
     <tspan>Referenced text</tspan>
   </text>

OR

   <defs>
     <text id="t">Referenced text</text>
   </defs>
   <text editable="true">
     Referenced text
   </text>

>What happens if you edit this text element?  Does the corresponding
>def'd text get modified?  If so, what if the tref referred to a text
>element in another document?  What (if anything) is the meaning of having
>editable="true" on the text in the defs element?

Nah that would corrupt stuff, especially, if you have many tags using that 
tref text.
<defs> stuff are like "constant string or text".


Now let's build a more interesting corner case:

   <defs>
     <text id="t">Referenced text
<tspan fill='red'>red</tspan>
<tspan fill='blue'>blue</tspan>
<tspan fill='green'>green</tspan></text>
   </defs>
   <text editable="true">
     <tref xlink:href="#t"/>
   </text>

becomes ?

   <defs>
     <text id="t">Referenced text
<tspan fill='red'>red</tspan>
<tspan fill='blue'>blue</tspan>
<tspan fill='green'>green</tspan></text>
   </defs>
   <text editable="true">
     <tref xlink:href="#t">Referenced text
<tspan fill='red'>red</tspan>
<tspan fill='blue'>blue</tspan>
<tspan fill='green'>green</tspan></tref>
   </text>

OR

   <defs>
     <text id="t">Referenced text
<tspan fill='red'>red</tspan>
<tspan fill='blue'>blue</tspan>
<tspan fill='green'>green</tspan></text>
   </defs>
   <text editable="true">
     <tspan xlink:href="#t">Referenced text
<tspan fill='red'>red</tspan>
<tspan fill='blue'>blue</tspan>
<tspan fill='green'>green</tspan></tspan>
   </text>

OR

   <defs>
     <text id="t">Referenced text
<tspan fill='red'>red</tspan>
<tspan fill='blue'>blue</tspan>
<tspan fill='green'>green</tspan></text>
   </defs>
   <text editable="true">
     Referenced text
<tspan fill='red'>red</tspan>
<tspan fill='blue'>blue</tspan>
<tspan fill='green'>green</tspan>
   </text>

>Another issue is with xml:space.  In these examples there is the default
>value of xml:space="default".  In this case, whenever the user types
>a space into the editable text element, will no change occur to the
>rendering of the text element?

_________________________________________________________________
Add photos to your e-mail with MSN Premium. Get 2 months FREE*  
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines
Received on Thursday, 29 April 2004 21:44:39 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:27 GMT