mirror of
				https://github.com/flynx/pWiki.git
				synced 2025-10-31 02:50:08 +00:00 
			
		
		
		
	bugfix and cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									0524c26c0c
								
							
						
					
					
						commit
						91ed572a32
					
				| @ -288,7 +288,7 @@ var quoted = { | |||||||
| 	quote: function(_, code){ | 	quote: function(_, code){ | ||||||
| 		return `<code>${ this.encode(code) }</code>` }, | 		return `<code>${ this.encode(code) }</code>` }, | ||||||
| 
 | 
 | ||||||
| 	pre_pattern: /(?<!\\)```(.*\s*\n)((\n|.)*?)\h*(?<!\\)```[ \t]*(?:$|\n)/g, | 	pre_pattern: /(?<!\\)```(.*\s*\n)((\n|.)*?)\h*(?<!\\)```[ \t]*(?:$|\n)/gm, | ||||||
| 	preEncode: function(text){ | 	preEncode: function(text){ | ||||||
| 		return this.encode(text) | 		return this.encode(text) | ||||||
| 			.replace(/`/, '\\`') }, | 			.replace(/`/, '\\`') }, | ||||||
| @ -912,7 +912,7 @@ var JSONOutline = { | |||||||
| 			code.replace(/\x00/g, '')) | 			code.replace(/\x00/g, '')) | ||||||
| 		// split text into parsable and non-parsable sections...
 | 		// split text into parsable and non-parsable sections...
 | ||||||
| 		var sections = text | 		var sections = text | ||||||
| 			// split fomat:
 | 			// split format:
 | ||||||
| 			// 	[ text <match> <type> <body>, ... ]
 | 			// 	[ text <match> <type> <body>, ... ]
 | ||||||
| 			.split(/(<(pre|code)(?:|\s[^>]*)>((?:\n|.)*)<\/\2>)/g) | 			.split(/(<(pre|code)(?:|\s[^>]*)>((?:\n|.)*)<\/\2>)/g) | ||||||
| 		// sort out the sections...
 | 		// sort out the sections...
 | ||||||
| @ -934,14 +934,11 @@ var JSONOutline = { | |||||||
| 			.join('')  | 			.join('')  | ||||||
| 		// stage: post...
 | 		// stage: post...
 | ||||||
| 		elem.text = run('post', text) | 		elem.text = run('post', text) | ||||||
| 
 | 		// patch for showing trailing empty lines in dom...
 | ||||||
| 
 |  | ||||||
| 		elem.text =  | 		elem.text =  | ||||||
| 			// XXX POST_PRE_WHITESPACE adding a </pre> exception here feels hacky...
 |  | ||||||
| 			// 		...a space after pre will force a new line but not 
 |  | ||||||
| 			// 		adding it will hide a single empty line after...
 |  | ||||||
| 			(elem.text == ''  | 			(elem.text == ''  | ||||||
| 					|| elem.text.endsWith('</pre>')) ? | 					// XXX adding a </pre> exception here feels hacky...
 | ||||||
|  | 					|| elem.text.trim().endsWith('</pre>')) ? | ||||||
| 				elem.text  | 				elem.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...
 | ||||||
| @ -1930,16 +1927,16 @@ var Outline = { | |||||||
| 			.clear() | 			.clear() | ||||||
| 			.outline | 			.outline | ||||||
| 				.append(...level(data)) | 				.append(...level(data)) | ||||||
| 		// update sizes of all the textareas (transparent)...
 | 		//// update sizes of all the textareas (transparent)...
 | ||||||
| 		// NOTE: this is needed to make initial clicking into multi-line 
 | 		//// NOTE: this is needed to make initial clicking into multi-line 
 | ||||||
| 		// 		blocks place the cursor into the clicked location.
 | 		//// 		blocks place the cursor into the clicked location.
 | ||||||
| 		// 		...this is done by expanding the textarea to the element 
 | 		//// 		...this is done by expanding the textarea to the element 
 | ||||||
| 		// 		size and enabling it to intercept clicks correctly...
 | 		//// 		size and enabling it to intercept clicks correctly...
 | ||||||
| 		setTimeout(function(){ | 		//setTimeout(function(){
 | ||||||
| 			var f = that._updateCodeSize | 		//	var f = that._updateCodeSize
 | ||||||
| 			//var f = that._syncTextSize.bind(that)
 | 		//	//var f = that._syncTextSize.bind(that)
 | ||||||
| 			for(var e of [...that.outline.querySelectorAll('textarea')]){ | 		//	for(var e of [...that.outline.querySelectorAll('textarea')]){
 | ||||||
| 				f(e) } }, 0) | 		//		f(e) } }, 0)
 | ||||||
| 		return this }, | 		return this }, | ||||||
| 	/*/ // XXX JSON version...
 | 	/*/ // XXX JSON version...
 | ||||||
| 	load: function(data){ | 	load: function(data){ | ||||||
|  | |||||||
| @ -48,40 +48,6 @@ var setup = function(){ | |||||||
|   -  |   -  | ||||||
| - ## Bugs: | - ## Bugs: | ||||||
|   focused:: true |   focused:: true | ||||||
|   - BUG whitespace after trailing code block is not shown (see next bug for details) |  | ||||||
|     - also see: `POST_PRE_WHITESPACE` |  | ||||||
|   - DONE BUG horizontal whitespace after a block of code create an empty line after the `<pre>` tag... |  | ||||||
|     collapsed:: true |  | ||||||
|     - ``` |  | ||||||
|       code block -- resized on block edit (`keydown` in edit mode) |  | ||||||
|       ``` |  | ||||||
|       - this is due to `.update(..)` adding a `' '` to the text... |  | ||||||
|   - DONE BUG leading/trailing blank lines mishandled: |  | ||||||
|     collapsed:: true |  | ||||||
|     - block sizing |  | ||||||
|       - issues: |  | ||||||
|         -  |  | ||||||
|           blank lines above and below -- the trailing blank is not initially shown |  | ||||||
|            |  | ||||||
|         - the main reason for this is that we are not adding a `" "` after each generated block as we do on `.update(..)` -- move this functionality up... |  | ||||||
|     - blank line at end of block is initially not shown |  | ||||||
|       - this block contains two lines (empty below) |  | ||||||
|          |  | ||||||
|         - ``` |  | ||||||
|           editor.Block( |  | ||||||
|                   editor.data( |  | ||||||
|                       editor.get())) |  | ||||||
|               .querySelector('.view').innerHTML // formatting is OK... |  | ||||||
|           ``` |  | ||||||
|         - _...this is a resize issue (???)_ |  | ||||||
|         - running `.updateSize() and then `._updateViewSize(..)` does not fix the issue... |  | ||||||
|         - simply replacing `._updateCodeSize(..)` with `._syncTextSize(..)` fixes this but breaks lots more stuff... |  | ||||||
|           _...need a better sync mechanism, preferably CSS_ |  | ||||||
|       -  |  | ||||||
|         this block also contains two lines (empty above) |  | ||||||
|       -  |  | ||||||
|         this block contains three lines (empty above and below) |  | ||||||
|          |  | ||||||
|   - BUG: styling error... |   - BUG: styling error... | ||||||
|     - this _seems `to` work_ |     - this _seems `to` work_ | ||||||
|     - `while` _this `does` not_ |     - `while` _this `does` not_ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user