Skip to content

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

Open
K1llsh0t wants to merge 10 commits intohh-lohmann:masterfrom
tomFlidr:master
Open

Adding functionality that if user does not select take the current(view) document text #2
K1llsh0t wants to merge 10 commits intohh-lohmann:masterfrom
tomFlidr:master

Conversation

@K1llsh0t
Copy link

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;
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants