now text editor is a textarea, still experimenting...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-10-31 04:24:12 +03:00
parent cedd1bbb79
commit 5e7707696a
2 changed files with 48 additions and 7 deletions

View File

@ -1878,6 +1878,7 @@ object.Constructor('CachedPage', Page, {
//--------------------------------------------------------------------- //---------------------------------------------------------------------
var wikiword = require('./dom/wikiword') var wikiword = require('./dom/wikiword')
var textarea = require('./dom/textarea')
var pWikiPageElement = var pWikiPageElement =
module.pWikiPageElement = module.pWikiPageElement =
@ -1892,6 +1893,7 @@ object.Constructor('pWikiPageElement', Page, {
domFilters: { domFilters: {
// XXX see Page.filters.wikiword for notes... // XXX see Page.filters.wikiword for notes...
wikiword: wikiword.wikiWordText, wikiword: wikiword.wikiWordText,
textarea: textarea.setupTextarea,
}, },
// XXX CACHE // XXX CACHE
@ -2068,6 +2070,7 @@ module.System = {
+'</pre>' +'</pre>'
+'</macro>'}, +'</macro>'},
//*/ //*/
/* XXX textarea or contenteditable -- the later has annoying editor features...
edit: { edit: {
// XXX not sure if we should use .title or .name here... // XXX not sure if we should use .title or .name here...
text: object.doc` text: object.doc`
@ -2080,11 +2083,13 @@ module.System = {
<slot content> <slot content>
<macro src=".." join="@source(file-separator)"> <macro src=".." join="@source(file-separator)">
<h1 class="title-editor" <h1>
wikiwords="no" <span class="title-editor"
contenteditable wikiwords="no"
oninput="saveContent(\'@source(s ./path)/title\', this.innerText)"> contenteditable
@source(./title) oninput="saveContent(\'@source(s ./path)/title\', this.innerText)">
@source(./title)
</span>
</h1> </h1>
<pre class="editor" <pre class="editor"
wikiwords="no" wikiwords="no"
@ -2093,6 +2098,36 @@ module.System = {
><quote filter="quote-tags" src="."/></pre> ><quote filter="quote-tags" src="."/></pre>
</macro> </macro>
</slot>`}, </slot>`},
/*/
edit: {
// XXX not sure if we should use .title or .name here...
text: object.doc`
<slot pre>
<title>@source(../title) (edit)</title>
</slot>
<slot parent>../..</slot>
<slot location>@source(../location/!)</slot>
<slot content>
<macro src=".." join="@source(file-separator)">
<h1>
<span class="title-editor"
wikiwords="no"
contenteditable
oninput="saveContent(\'@source(s ./path)/title\', this.innerText)">
@source(./title)
</span>
</h1>
<textarea class="editor"
style="width:100%;"
wikiwords="no"
contenteditable
oninput="saveLiveContent(\'@source(s ./path)\', this.value)"
><quote filter="quote-tags" src="."/></textarea>
</macro>
</slot>`},
//*/
// XXX debug... // XXX debug...
_path: {text: '@source(./path/! join=" ")'}, _path: {text: '@source(./path/! join=" ")'},

View File

@ -150,9 +150,15 @@ body.loading .page.spinner span {
} }
} }
[contenteditable] { textarea {
outline: 0px solid transparent; font-size: 1.2em;
border: none;
resize: none;
} }
[contenteditable] {
outline: 0px solid transparent;
}
textarea:empty:after,
[contenteditable]:empty:after { [contenteditable]:empty:after {
display: block; display: block;
content: 'Empty'; content: 'Empty';