Notepad-JS-HTML-Beautifier-Plugin icon indicating copy to clipboard operation
Notepad-JS-HTML-Beautifier-Plugin copied to clipboard

Adding functionality that if user does not select take the current(view) document text

Open K1llsh0t opened this issue 3 years ago • 0 comments

Following part modified to get proper position

getSelectionPositions: function(){

			_if (!this.context.selection){
				return { 
					start: this.byteToChars(0),
					end: this.byteToChars(this.context.text.length) 
				};
			};_			
			
			return { 
				start: this.byteToChars(
					Math.min(this.context.anchor, this.context.pos)
				),
				end: this.byteToChars(
					Math.max(this.context.anchor, this.context.pos)
				)
			};
		},

Following edited to pick current document getContent: function(){ this.updateContext(); if (!this.context.selection){return this.context.text}; return this.context.selection; },

K1llsh0t avatar Jan 30 '22 20:01 K1llsh0t