atom-web-ui
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -120,2 +120,4 @@ /// <reference path="../../typings/main.d.ts" /> | ||
constructor(editorPath: string, id?: string); | ||
doAceSetup(ace: any): void; | ||
setAceEditor(aceEditor: any): void; | ||
getTitle(): string; | ||
@@ -122,0 +124,0 @@ onDidChangeCursorPosition(callback: any): { |
@@ -7,3 +7,3 @@ "use strict"; | ||
var html = require("../../src/static/workspace.html"); | ||
var global = getGlobal(); | ||
require("../../src/static/ace"); | ||
var isMutationSupport; | ||
@@ -496,4 +496,4 @@ var Workspace = (function () { | ||
this.id = editorPath; | ||
var _this = this; | ||
_this['soft-tabs'] = {}; | ||
var self = this; | ||
self['soft-tabs'] = {}; | ||
this.textElement.className = 'editor'; | ||
@@ -514,3 +514,67 @@ this.textElement.style.position = 'relative'; | ||
var textEditor = this; | ||
this.element.addEventListener('DOMNodeInserted', function (event) { | ||
if (textEditor.ace) { | ||
return; | ||
} | ||
textEditor.doAceSetup(window.ace); | ||
}); | ||
} | ||
TextEditor.prototype.doAceSetup = function (ace) { | ||
this.ace = ace; | ||
if (!ace) { | ||
return; | ||
} | ||
var aceEditor = ace.edit(this.textElement.id); | ||
// var langTools: any = ace.require('ace/ext/language_tools'); | ||
// | ||
// aceEditor.setTheme('ace/theme/tomorrow_night'); | ||
//langTools.setCompleters([]); | ||
//aceEditor.getSession().setMode(this.getMode()); | ||
//aceEditor.getSession().off("change", aceEditor.renderer.$gutterLayer.$updateAnnotations); | ||
aceEditor.setOptions({ | ||
enableBasicAutocompletion: true, | ||
enableLiveAutocompletion: true | ||
}); | ||
this.setAceEditor(aceEditor); | ||
// if(this.extension === '.raml') { | ||
// var AceCompleter = getLazy('aceStuff').AceCompleter; | ||
// | ||
// langTools.addCompleter(new AceCompleter(this)); | ||
// } | ||
}; | ||
TextEditor.prototype.setAceEditor = function (aceEditor) { | ||
var _this = this; | ||
this.aceEditor = aceEditor; | ||
var textBuffer = this.getBuffer(); | ||
textBuffer.characterIndexForPosition = function (position) { | ||
var result = aceEditor.getSession().getDocument().positionToIndex({ row: position.row, column: position.column }, 0); | ||
return result; | ||
}; | ||
textBuffer.positionForCharacterIndex = function (index) { | ||
var result = aceEditor.getSession().getDocument().indexToPosition(index, 0); | ||
return result; | ||
}; | ||
textBuffer.setTextInRange = function (range, value) { | ||
var AceRange = _this.ace.require("ace/range").Range; | ||
var preparedRange = getRange(range.start.row, range.start.column, range.end.row, range.end.column); | ||
var aceRange = new AceRange(preparedRange.start.row, preparedRange.start.column, preparedRange.end.row, preparedRange.end.column); | ||
aceEditor.getSession().replace(aceRange, value); | ||
}; | ||
textBuffer.setText = function (text) { | ||
var top = _this.aceEditor.session.getScrollTop(); | ||
_this.aceEditor.setValue(text, 100); | ||
_this.aceEditor.resize(true); | ||
_this.aceEditor.session.setScrollTop(top); | ||
}; | ||
this.aceEditor.session.setValue(textBuffer.getText()); | ||
var textEditor = this; | ||
var extension = this.extension; | ||
this.aceEditor.session.selection.on("changeCursor", function (event) { | ||
textEditor.getLastCursor().doChangePosition(); | ||
}); | ||
this.aceEditor.on('change', function (arg) { | ||
textBuffer.text = aceEditor.getValue(); | ||
textBuffer.doChange(arg); | ||
}); | ||
}; | ||
TextEditor.prototype.getTitle = function () { | ||
@@ -517,0 +581,0 @@ return path.basename(this.editorPath) + path.extname(this.editorPath); |
{ | ||
"name": "atom-web-ui", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -7,3 +7,3 @@ "use strict"; | ||
var html = require("../../src/static/workspace.html"); | ||
var global = getGlobal(); | ||
require("../../src/static/ace"); | ||
var isMutationSupport; | ||
@@ -496,4 +496,4 @@ var Workspace = (function () { | ||
this.id = editorPath; | ||
var _this = this; | ||
_this['soft-tabs'] = {}; | ||
var self = this; | ||
self['soft-tabs'] = {}; | ||
this.textElement.className = 'editor'; | ||
@@ -514,3 +514,67 @@ this.textElement.style.position = 'relative'; | ||
var textEditor = this; | ||
this.element.addEventListener('DOMNodeInserted', function (event) { | ||
if (textEditor.ace) { | ||
return; | ||
} | ||
textEditor.doAceSetup(window.ace); | ||
}); | ||
} | ||
TextEditor.prototype.doAceSetup = function (ace) { | ||
this.ace = ace; | ||
if (!ace) { | ||
return; | ||
} | ||
var aceEditor = ace.edit(this.textElement.id); | ||
// var langTools: any = ace.require('ace/ext/language_tools'); | ||
// | ||
// aceEditor.setTheme('ace/theme/tomorrow_night'); | ||
//langTools.setCompleters([]); | ||
//aceEditor.getSession().setMode(this.getMode()); | ||
//aceEditor.getSession().off("change", aceEditor.renderer.$gutterLayer.$updateAnnotations); | ||
aceEditor.setOptions({ | ||
enableBasicAutocompletion: true, | ||
enableLiveAutocompletion: true | ||
}); | ||
this.setAceEditor(aceEditor); | ||
// if(this.extension === '.raml') { | ||
// var AceCompleter = getLazy('aceStuff').AceCompleter; | ||
// | ||
// langTools.addCompleter(new AceCompleter(this)); | ||
// } | ||
}; | ||
TextEditor.prototype.setAceEditor = function (aceEditor) { | ||
var _this = this; | ||
this.aceEditor = aceEditor; | ||
var textBuffer = this.getBuffer(); | ||
textBuffer.characterIndexForPosition = function (position) { | ||
var result = aceEditor.getSession().getDocument().positionToIndex({ row: position.row, column: position.column }, 0); | ||
return result; | ||
}; | ||
textBuffer.positionForCharacterIndex = function (index) { | ||
var result = aceEditor.getSession().getDocument().indexToPosition(index, 0); | ||
return result; | ||
}; | ||
textBuffer.setTextInRange = function (range, value) { | ||
var AceRange = _this.ace.require("ace/range").Range; | ||
var preparedRange = getRange(range.start.row, range.start.column, range.end.row, range.end.column); | ||
var aceRange = new AceRange(preparedRange.start.row, preparedRange.start.column, preparedRange.end.row, preparedRange.end.column); | ||
aceEditor.getSession().replace(aceRange, value); | ||
}; | ||
textBuffer.setText = function (text) { | ||
var top = _this.aceEditor.session.getScrollTop(); | ||
_this.aceEditor.setValue(text, 100); | ||
_this.aceEditor.resize(true); | ||
_this.aceEditor.session.setScrollTop(top); | ||
}; | ||
this.aceEditor.session.setValue(textBuffer.getText()); | ||
var textEditor = this; | ||
var extension = this.extension; | ||
this.aceEditor.session.selection.on("changeCursor", function (event) { | ||
textEditor.getLastCursor().doChangePosition(); | ||
}); | ||
this.aceEditor.on('change', function (arg) { | ||
textBuffer.text = aceEditor.getValue(); | ||
textBuffer.doChange(arg); | ||
}); | ||
}; | ||
TextEditor.prototype.getTitle = function () { | ||
@@ -517,0 +581,0 @@ return path.basename(this.editorPath) + path.extname(this.editorPath); |
@@ -8,3 +8,3 @@ /// <reference path="../../typings/main.d.ts" /> | ||
var global = getGlobal(); | ||
require("../../src/static/ace"); | ||
@@ -735,5 +735,5 @@ var isMutationSupport: boolean; | ||
var _this: any = <any>this; | ||
var self: any = <any>this; | ||
_this['soft-tabs'] = {}; | ||
self['soft-tabs'] = {}; | ||
@@ -764,3 +764,100 @@ this.textElement.className = 'editor'; | ||
var textEditor = this; | ||
this.element.addEventListener('DOMNodeInserted', event => { | ||
if(textEditor.ace) { | ||
return; | ||
} | ||
textEditor.doAceSetup((<any>window).ace); | ||
}) | ||
} | ||
doAceSetup(ace: any) { | ||
this.ace = ace; | ||
if(!ace) { | ||
return; | ||
} | ||
var aceEditor: any = ace.edit(this.textElement.id); | ||
// var langTools: any = ace.require('ace/ext/language_tools'); | ||
// | ||
// aceEditor.setTheme('ace/theme/tomorrow_night'); | ||
//langTools.setCompleters([]); | ||
//aceEditor.getSession().setMode(this.getMode()); | ||
//aceEditor.getSession().off("change", aceEditor.renderer.$gutterLayer.$updateAnnotations); | ||
aceEditor.setOptions({ | ||
enableBasicAutocompletion: true, | ||
enableLiveAutocompletion: true | ||
}); | ||
this.setAceEditor(aceEditor); | ||
// if(this.extension === '.raml') { | ||
// var AceCompleter = getLazy('aceStuff').AceCompleter; | ||
// | ||
// langTools.addCompleter(new AceCompleter(this)); | ||
// } | ||
} | ||
setAceEditor(aceEditor: any) { | ||
this.aceEditor = aceEditor; | ||
var textBuffer = this.getBuffer(); | ||
textBuffer.characterIndexForPosition = function (position:Point) { | ||
var result = aceEditor.getSession().getDocument().positionToIndex({row: position.row, column: position.column}, 0); | ||
return result; | ||
} | ||
textBuffer.positionForCharacterIndex = function (index:number) { | ||
var result = aceEditor.getSession().getDocument().indexToPosition(index, 0); | ||
return result; | ||
} | ||
textBuffer.setTextInRange = (range:Range, value:string) => { | ||
var AceRange = this.ace.require("ace/range").Range; | ||
var preparedRange: Range = getRange(range.start.row, range.start.column, range.end.row, range.end.column); | ||
var aceRange = new AceRange(preparedRange.start.row, preparedRange.start.column, preparedRange.end.row, preparedRange.end.column); | ||
aceEditor.getSession().replace(aceRange, value); | ||
} | ||
textBuffer.setText = (text: string) => { | ||
var top = this.aceEditor.session.getScrollTop(); | ||
this.aceEditor.setValue(text, 100); | ||
this.aceEditor.resize(true); | ||
this.aceEditor.session.setScrollTop(top); | ||
} | ||
this.aceEditor.session.setValue(textBuffer.getText()); | ||
var textEditor = this; | ||
var extension = this.extension; | ||
this.aceEditor.session.selection.on("changeCursor", function (event: any) { | ||
textEditor.getLastCursor().doChangePosition(); | ||
}) | ||
this.aceEditor.on('change', (arg: any) => { | ||
textBuffer.text = aceEditor.getValue(); | ||
textBuffer.doChange(arg); | ||
}); | ||
} | ||
@@ -767,0 +864,0 @@ getTitle(): string { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2259207
41
53048
17