mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-29 18:10:09 +00:00
now whitespace working correctly...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
8368ee43aa
commit
ebf201d6a4
@ -767,7 +767,6 @@ var Outline = {
|
|||||||
tab_size: 4,
|
tab_size: 4,
|
||||||
carot_jump_edge_then_block: false,
|
carot_jump_edge_then_block: false,
|
||||||
// XXX not sure what should the default be...
|
// XXX not sure what should the default be...
|
||||||
// XXX this should not affect editing...
|
|
||||||
trim_block_text: false,
|
trim_block_text: false,
|
||||||
|
|
||||||
|
|
||||||
@ -1081,7 +1080,7 @@ var Outline = {
|
|||||||
// NOTE: we are ignoring the .collapsed attr here
|
// NOTE: we are ignoring the .collapsed attr here
|
||||||
parsed = this.__code2html__(data.text, {...data})
|
parsed = this.__code2html__(data.text, {...data})
|
||||||
html.innerHTML =
|
html.innerHTML =
|
||||||
parsed.text.length == 0 ?
|
parsed.text == '' ?
|
||||||
parsed.text
|
parsed.text
|
||||||
// NOTE: adding a space here is done to prevent the browser
|
// NOTE: adding a space here is done to prevent the browser
|
||||||
// from hiding the last newline...
|
// from hiding the last newline...
|
||||||
@ -1094,7 +1093,7 @@ var Outline = {
|
|||||||
delete parsed.style
|
delete parsed.style
|
||||||
} else {
|
} else {
|
||||||
html.innerHTML =
|
html.innerHTML =
|
||||||
data.text.length == 0 ?
|
data.text == '' ?
|
||||||
data.text
|
data.text
|
||||||
// NOTE: adding a space here is done to prevent the browser
|
// NOTE: adding a space here is done to prevent the browser
|
||||||
// from hiding the last newline...
|
// from hiding the last newline...
|
||||||
@ -1362,7 +1361,7 @@ var Outline = {
|
|||||||
|
|
||||||
// only whitespace -> keep element blank...
|
// only whitespace -> keep element blank...
|
||||||
if(code.trim() == ''){
|
if(code.trim() == ''){
|
||||||
elem.text = ''
|
elem.text = code
|
||||||
return elem }
|
return elem }
|
||||||
|
|
||||||
// helpers...
|
// helpers...
|
||||||
@ -1412,8 +1411,11 @@ var Outline = {
|
|||||||
return code
|
return code
|
||||||
.replace(/(\n\s*)-/g, '$1\\-') },
|
.replace(/(\n\s*)-/g, '$1\\-') },
|
||||||
__text2code__: function(text){
|
__text2code__: function(text){
|
||||||
return text
|
text = text
|
||||||
.replace(/(\n\s*)\\-/g, '$1-') },
|
.replace(/(\n\s*)\\-/g, '$1-')
|
||||||
|
return this.trim_block_text ?
|
||||||
|
text.trim()
|
||||||
|
: text },
|
||||||
|
|
||||||
// serialization...
|
// serialization...
|
||||||
data: function(elem, deep=true){
|
data: function(elem, deep=true){
|
||||||
@ -2159,7 +2161,10 @@ var Outline = {
|
|||||||
if(elem.classList.contains('code')){
|
if(elem.classList.contains('code')){
|
||||||
var block = that.get(elem)
|
var block = that.get(elem)
|
||||||
// clean out attrs...
|
// clean out attrs...
|
||||||
elem.value = that.parseBlockAttrs(elem.value).text
|
elem.value =
|
||||||
|
that.trim_block_text ?
|
||||||
|
that.parseBlockAttrs(elem.value).text.trim()
|
||||||
|
: that.parseBlockAttrs(elem.value).text
|
||||||
that.update(block)
|
that.update(block)
|
||||||
// undo...
|
// undo...
|
||||||
if(elem.value != elem.dataset.original){
|
if(elem.value != elem.dataset.original){
|
||||||
|
|||||||
@ -48,7 +48,6 @@ var setup = function(){
|
|||||||
-
|
-
|
||||||
- ## Bugs:
|
- ## Bugs:
|
||||||
focused:: true
|
focused:: true
|
||||||
- BUG: `.trim_block_text` should not affect editing...
|
|
||||||
- BUG: mobile browsers behave quite chaotically ignoring parts of the styling...
|
- BUG: mobile browsers behave quite chaotically ignoring parts of the styling...
|
||||||
- FF:
|
- FF:
|
||||||
- zooming on edited field
|
- zooming on edited field
|
||||||
@ -57,23 +56,6 @@ var setup = function(){
|
|||||||
- side margins are a bit too large (account for toolbat to the right)
|
- side margins are a bit too large (account for toolbat to the right)
|
||||||
-
|
-
|
||||||
- ## ToDo:
|
- ## ToDo:
|
||||||
- trailing whitespace is ignored in `.view`... (BUG?)
|
|
||||||
- demos:
|
|
||||||
-
|
|
||||||
leading whitespace...
|
|
||||||
- trailing whitespace...
|
|
||||||
|
|
||||||
- empty block is not correctly shown\:
|
|
||||||
-
|
|
||||||
|
|
||||||
|
|
||||||
- _it seams that HTML ignores the last newline if it is not followed by anything_
|
|
||||||
- there are four ways to deal with this:#
|
|
||||||
- trim whitespace on refocus
|
|
||||||
- show whitespace in both modes
|
|
||||||
- REJECT remove trailing whitespace completely on refocus (a-la logseq)
|
|
||||||
- REJECT keep current behavior
|
|
||||||
- I do not believe in keeping whitespace in edit and hiding it in view (POLS)
|
|
||||||
- custom element / web component
|
- custom element / web component
|
||||||
- Q: can we get rid of the editor block??:
|
- Q: can we get rid of the editor block??:
|
||||||
- CSS breaks if we do...
|
- CSS breaks if we do...
|
||||||
@ -147,6 +129,24 @@ var setup = function(){
|
|||||||
- empty item height is a bit off...
|
- empty item height is a bit off...
|
||||||
- search?
|
- search?
|
||||||
- _...not sure if search should be internal or external yet..._
|
- _...not sure if search should be internal or external yet..._
|
||||||
|
- DONE trailing whitespace is ignored in `.view`...
|
||||||
|
collapsed:: true
|
||||||
|
- demos:
|
||||||
|
-
|
||||||
|
leading whitespace...
|
||||||
|
- trailing whitespace...
|
||||||
|
|
||||||
|
- empty block\:
|
||||||
|
-
|
||||||
|
|
||||||
|
|
||||||
|
- _it seams that HTML ignores the last newline if it is not followed by anything_
|
||||||
|
- there are four ways to deal with this:#
|
||||||
|
- trim whitespace on refocus (option)
|
||||||
|
- show whitespace in both modes (option)
|
||||||
|
- REJECT remove trailing whitespace completely on refocus (a-la logseq)
|
||||||
|
- REJECT keep current behavior
|
||||||
|
- I do not believe in keeping whitespace in edit and hiding it in view (POLS)
|
||||||
- DONE add options to save to `.sessionStorage` / `.localStorage`
|
- DONE add options to save to `.sessionStorage` / `.localStorage`
|
||||||
- DONE might be a good idea to focus the prev (empty) node if pressing `Enter` at 0 position
|
- DONE might be a good idea to focus the prev (empty) node if pressing `Enter` at 0 position
|
||||||
collapsed:: true
|
collapsed:: true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user