Skip to content

Editing "content edltable" element

akahuku edited this page Feb 9, 2017 · 2 revisions

Editing "content editable" element

There are some web sites which uses rich input field (or content editable element). wasavi can edit a content editable element, but all styling formats are lost by :write command. To fix this problem, an experimental functionality about editing "content editable" element is added to wasavi/0.6.630 or later:

1. wasavi converts the content of "content editable" element to markdown.

2. Some elements will be converted to a special tag, not markdown.

img, a, embed and object elements, these are converted to a link element with the ID to the original element, eg:

<wasavi:img id="tmpid_0000"></wasavi:img>

3. New option writeas

This option describes how to write wasavi's buffer to target element, and can be set following values:

  • div - each line of buffer is converted to DIV element
  • p - each line of buffer is converted to P element
  • textAndBreak - each line of buffer is converted to text node and BR element
  • plaintext - whole buffer is converted to one text node
  • html - treat wasavi's buffer as markdown, and build HTML
  • a string can be parsed as JSON - This allows you to define the writeas value in detail for each site
set writeas='{ \
  "http://example.com/*": "div", \
  "http://example.net/*": [ \
    { \
      "selector": "#any-css-selector", \
      "writeas": "textAndBreak" \
    } \
  ] \
}'