wiki:EditingWebmoredText

Editing webmored text

The process

We have some webmored text (a comment or an article) stored in the database. When the user clicks "Edit", we (1) present it to her, via an interface that has simple textarea edit and fckeditor living together. The user edits the text, and then clicks commit, when we (2) receive the text, check it (parse and optionally modify it), and store it back to the database.

Presenting the text

We present the text to the editor component as an extended xhtml text. The extension we use is that there can be <webmore.../> tags in it.

Ideally we store the text always in this form, checked, in the database.

We don't necessarily support full xhtml.

Receiving the text

Naturally we check the text if it is valid (by the subset of extended xhtml that we support).

Webmore tags

We compare the set of webmore tags that we received to the set that we presented.

If there are new webmore tags, that is taken as a malicious attack. We either drop them, or reject the commit.

If there are webmore tags missing compared to the version we presented, they're consolidated to single webmore tag with brand-new anchor and reattached="1" attribute, and this tag is added to the end of the text. So, accidentally removed anchors are displayed in one sock after comment body and some "these comments were removed" text.