Re: Simple template-based editing

Bert,

I would like to ask question common to both html::contetEditable and 
css::editable solutions:

How edited content supposed to be saved/sent?

Without answering on it makes no much sense to discuss "editability".
If it would be no standard way to upload changes then it means
that solution will be *always* UA specific. And UAs are free to choose
convenient method of marking up editable areas in each particular case.

---- informational side note for the discussion ---------------:

Here is a solution we've implemented in one project for online in-place editing.

Instead of having contentEditable attribute in our rendering engine we've 
introduced new input
element <htmlarea> analogous to <textarea>.

The reason is simple: editable content should be "submitable" as any
other input field. This is why it is input element - we are reusing existing
form submission mechanism rather than inventing
something new. (contentEditable does not allow you to send content without use 
of scripting, sic!)

Some details if somebody interested,
major attributes of htmlarea:

src - url, source of the content, optional.
        Otherwise takes initial content in-place between
        <htmlarea> and </htmlarea>
allow - string, comma delimited list of tag names of allowed
       elements in the content.
reject -  string, comma delimited list of tag names of forbidden
       elements in the content.
format - string, name of "rich text" format of the value of
       the field, possible values: "html", "wiki", "blog", some other.
imagelist - url, list of images allowed to be inserted,
...etc.

Our htmlarea input element is a block element and can be placed as display: 
block and display:inline-block.
It inherits CSS styling of the content from its host document. It also knows 
about overflow CSS attribute
so it can be used as pure in-place editor or as editable area with fixed size.

One more: conceptually "Editability" is not presentational nor content 
definition attribute.
It is a behavioural attribute / entity. As any other input element it has its 
own set of
actions/operations. In my opinion it can be declared as CSS or html attribute.
contentEditable="yes, but how?"

Probably all above is out of scope slightly but it is a practical and proven 
solution.

Andrew Fedoniouk.
http://terrainformatica.com


----- Original Message ----- 
From: "Bert Bos" <bert@w3.org>
To: <www-style@w3.org>
Sent: Thursday, September 29, 2005 6:19 AM
Subject: Simple template-based editing


|
| A discussion here on the read-only/read-write pseudo-classes and another
| with some colleagues prompted me to think about a way to define very
| simple templates with CSS...
|
| The use case is an online page you want to edit and save back to the
| server (with HTTP PUT, Webdav, or even with FTP) and that has to
| conform to a certain format. Imagine, e.g., that the page is from a
| wiki, blog, or slide presentation.
|
| Presumably, the server will check what you send back, but assuming that
| you are trying to do the right thing, it would be good if the server
| could tell your browser/editor in a machine-readable way what changes
| are allowed.
|
| In general, a template consists of parts that you cannot edit and other
| that you can, plus information about the grammar of those parts. For
| example, some part may have only plain text of more than 10 but less
| than 100 characters, another accepts all inline HTML elements, yet
| another accepts most HTML body elements, except H1 and form elements,
| etc.
|
| But that general case is difficult. We don't have a ready made language
| to express those grammars, although DTDs and the various XML schema
| languages go a long way. But as I'm looking for something as simple as
| CSS, I think that general case is out of scope.
|
| Daniel Glazman's NVu, for example, has a simple template system that
| just allows you to distinguish elements that cannot be edited and those
| that can, and the latter come in four types (I'm sure Daniel will
| correct me if I miscounted them...):
|
| 1) Exactly one element: you can edit an element's content according to
| the DTD
|
| 2) Zero or one: you can edit the content or delete the element.
|
| 3) Zero or more: you can delete the element, edit its content and also
| make copies of the element (and edit their contents).
|
| 4) One or more: you can edit the content and make copies but at least
| one element must remain.
|
| (The way NVu currently does this is specific to HTML 4.01 Transitional
| and the template files themselves aren't valid SGML or XML, so they
| cannot be used for the online use case I outlined above.)
|
| So how about a property in CSS3
|
|    Name: editable
|    Value: auto | one | zero-or-one | zero-or-more | one-or-more
|    Initial: auto
|    Inherited: no
|
| to indicate that an element is a template or not? ('Auto' means it
| depends on whether the server supports PUT or an equivalent method.
| Better keywords welcome...)
|
| It's obviously very limited (no way to restrict the contents beyond the
| DTD), but it might still be useful and at least it is simple.
|
|
|
| Bert
| -- 
|  Bert Bos                                ( W 3 C ) http://www.w3.org/
|  http://www.w3.org/people/bos                               W3C/ERCIM
|  bert@w3.org                             2004 Rt des Lucioles / BP 93
|  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
| 

Received on Thursday, 29 September 2005 23:13:06 UTC