diff --git a/JukaApp.csproj b/JukaApp.csproj
index 6b937cf..5fb31a2 100644
--- a/JukaApp.csproj
+++ b/JukaApp.csproj
@@ -48,8 +48,8 @@
-
-
+
+
diff --git a/MauiProgram.cs b/MauiProgram.cs
index ec2780d..493604e 100644
--- a/MauiProgram.cs
+++ b/MauiProgram.cs
@@ -1,6 +1,4 @@
-using Microsoft.AspNetCore.Components.WebView.Maui;
-
-namespace JukaApp;
+namespace JukaApp;
public static class MauiProgram
{
diff --git a/Pages/Index.razor b/Pages/Index.razor
index 85cea39..aee5614 100644
--- a/Pages/Index.razor
+++ b/Pages/Index.razor
@@ -1,6 +1,7 @@
@page "/"
@using System.Text.Json
@using BlazorMonaco
+@using BlazorMonaco.Editor
@using JukaCompiler
@inject IJSRuntime JS
@@ -19,7 +20,7 @@ Enter Your Code Below and Click Run:
}
-
+
@@ -53,8 +54,8 @@ Enter Your Code Below and Click Run:
private string UriValue { get; set; } = "";
private string DarkMode { get; set; } = "🌕";
- private MonacoEditor _editor;
- private StandaloneEditorConstructionOptions EditorConstructionOptions(MonacoEditor editor)
+ private StandaloneCodeEditor _editor;
+ private StandaloneEditorConstructionOptions EditorConstructionOptions(StandaloneCodeEditor editor)
{
_editor = editor;
@@ -81,7 +82,7 @@ Enter Your Code Below and Click Run:
{
DateTime starttime = DateTime.Now;
await JS.InvokeVoidAsync("blazorMonaco.languages.register");
- await MonacoEditorBase.DefineTheme("JukaTheme", new StandaloneThemeData
+ await Global.DefineTheme("JukaTheme", new StandaloneThemeData
{
Base = "vs",
Inherit = true,
@@ -91,9 +92,15 @@ Enter Your Code Below and Click Run:
new() { Token = "keyword", Foreground = "FF4500" },
new() { Token = "number", Foreground = "54a154" },
new() { Token = "comment", Foreground = "888ed1" }
+ },
+ Colors = new Dictionary
+ {
+ ["editor.background"] = "#FFFFFF",
+ ["editorCursor.foreground"] = "#363636",
+ ["editorLineNumber.foreground"] = "#DADADA"
}
});
- await MonacoEditorBase.DefineTheme("JukaThemeDark", new StandaloneThemeData
+ await Global.DefineTheme("JukaThemeDark", new StandaloneThemeData
{
Base = "vs-dark",
Inherit = true,
@@ -103,10 +110,16 @@ Enter Your Code Below and Click Run:
new() { Token = "keyword", Foreground = "FF4500" },
new() { Token = "number", Foreground = "54a154" },
new() { Token = "comment", Foreground = "888ed1" }
+ },
+ Colors = new Dictionary
+ {
+ ["editor.background"] = "#363636",
+ ["editorCursor.foreground"] = "#E0E0E0",
+ ["editorLineNumber.foreground"] = "#7A7A7A"
}
});
- await MonacoEditorBase.SetTheme("JukaTheme");
+ await Global.SetTheme("JukaTheme");
tabs.GetCurrentTab().Output.Add("Juka Loaded. Click \"Run Code\" to run the code!",starttime);
}
@@ -195,6 +208,7 @@ Enter Your Code Below and Click Run:
{
DateTime starttime = DateTime.Now;
tabs.GetCurrentTab().Output.Add(new Compiler().Go(Data ?? "", false), starttime);
+ JS.InvokeVoidAsync("blazorMonaco.languages.focus");
}
@@ -202,13 +216,13 @@ Enter Your Code Below and Click Run:
{
if (DarkMode == "🌕")
{
- await MonacoEditorBase.SetTheme("JukaThemeDark");
+ await Global.SetTheme("JukaThemeDark");
await JS.InvokeVoidAsync("blazorMonaco.languages.dark");
DarkMode = "🌞";
}
else
{
- await MonacoEditorBase.SetTheme("JukaTheme");
+ await Global.SetTheme("JukaTheme");
await JS.InvokeVoidAsync("blazorMonaco.languages.light");
DarkMode = "🌕";
}
diff --git a/Pages/Notes.razor b/Pages/Notes.razor
index defb4ef..2406cd0 100644
--- a/Pages/Notes.razor
+++ b/Pages/Notes.razor
@@ -1,22 +1,25 @@
@page "/notes"
+@using System.Text.Json
+@using BlazorMonaco
+@using BlazorMonaco.Editor
+@inject IJSRuntime JS
Juka Notes
-
-
+
@code{
- public async Task UploadCode(InputFileChangeEventArgs e)
+ private StandaloneCodeEditor _editor;
+ private StandaloneEditorConstructionOptions EditorConstructionOptions(StandaloneCodeEditor editor)
{
- try
- {
- }
- catch (Exception)
+ _editor = editor;
+ return new StandaloneEditorConstructionOptions
{
-
- }
+ AutomaticLayout = true,
+ Language = "",
+ Value = "Notes"
+ };
}
}
\ No newline at end of file
diff --git a/TabList.cs b/TabList.cs
index b9b6551..06733b3 100644
--- a/TabList.cs
+++ b/TabList.cs
@@ -4,7 +4,7 @@ public class TabList
{
Queue tabs = new();
- public int CurrentTab = 0;
+ public int CurrentTab;
public TabList()
{
diff --git a/_Imports.razor b/_Imports.razor
index 92db70d..bba16a1 100644
--- a/_Imports.razor
+++ b/_Imports.razor
@@ -8,3 +8,4 @@
@using JukaApp.Shared
@using JukaCompiler
@using BlazorMonaco
+@using BlazorMonaco.Editor
diff --git a/wwwroot/jukaeditor.js b/wwwroot/jukaeditor.js
index c415024..185304e 100644
--- a/wwwroot/jukaeditor.js
+++ b/wwwroot/jukaeditor.js
@@ -1,5 +1,4 @@
-if (!require.getConfig().paths.vs) // for lte v1.2.0
- require.config({ paths: { 'vs': '_content/BlazorMonaco/lib/monaco-editor/min/vs' } });
+var require = { paths: { vs: '_content/BlazorMonaco/lib/monaco-editor/min/vs' } };
window.blazorMonaco = window.blazorMonaco || {};
window.blazorMonaco.editors = [];
@@ -98,6 +97,9 @@ window.blazorMonaco.languages = {
dark: function () {
document.documentElement.setAttribute("data-theme", "dark");
},
+ focus: function () {
+ document.getElementById("OutputVal").scrollIntoView();
+ },
download: function (text, name) {
var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
@@ -117,26 +119,28 @@ window.blazorMonaco.editor = {
//#region Static methods
- colorize: function (text, languageId, options) {
- return monaco.editor.colorize(text, languageId, options);
+ colorize: async function (text, languageId, options) {
+ let promise = monaco.editor.colorize(text, languageId, options);
+ return await promise;
},
- colorizeElement: function (elementId, options) {
- return monaco.editor.colorizeElement(document.getElementById(elementId), options);
+ colorizeElement: async function (elementId, options) {
+ let promise = monaco.editor.colorizeElement(document.getElementById(elementId), options);
+ await promise;
},
colorizeModelLine: function (uriStr, lineNumber, tabSize) {
- var model = this.model.getJsObject(uriStr);
+ var model = this.model.getModel(uriStr);
if (model == null)
return null;
return monaco.editor.colorizeModelLine(model, lineNumber, tabSize);
},
- create: function (id, options, dotnetRef) {
+ create: function (id, options, override, dotnetRef) {
if (options == null)
options = {};
- var oldEditor = this.getEditorById(id, true);
+ var oldEditor = this.getEditor(id, true);
if (oldEditor !== null) {
options.value = oldEditor.getValue();
window.blazorMonaco.editors.splice(window.blazorMonaco.editors.findIndex(item => item.id === id), 1);
@@ -152,17 +156,15 @@ window.blazorMonaco.editor = {
}
}
-
-
- var editor = monaco.editor.create(document.getElementById(id), options);
+ var editor = monaco.editor.create(document.getElementById(id), options, override);
window.blazorMonaco.editors.push({ id: id, editor: editor, dotnetRef: dotnetRef });
},
- createDiffEditor: function (id, options, dotnetRef) {
+ createDiffEditor: function (id, options, override, dotnetRef, dotnetRefOriginal, dotnetRefModified) {
if (options == null)
options = {};
- var oldEditor = this.getEditorById(id, true);
+ var oldEditor = this.getEditor(id, true);
var oldModel = null;
if (oldEditor !== null) {
oldModel = oldEditor.getModel();
@@ -182,10 +184,10 @@ window.blazorMonaco.editor = {
}
}
- var editor = monaco.editor.createDiffEditor(document.getElementById(id), options);
+ var editor = monaco.editor.createDiffEditor(document.getElementById(id), options, override);
window.blazorMonaco.editors.push({ id: id, editor: editor, dotnetRef: dotnetRef });
- window.blazorMonaco.editors.push({ id: id + "_original", editor: editor.getOriginalEditor() });
- window.blazorMonaco.editors.push({ id: id + "_modified", editor: editor.getModifiedEditor() });
+ window.blazorMonaco.editors.push({ id: id + "_original", editor: editor.getOriginalEditor(), dotnetRef: dotnetRefOriginal });
+ window.blazorMonaco.editors.push({ id: id + "_modified", editor: editor.getModifiedEditor(), dotnetRef: dotnetRefModified });
if (oldModel !== null)
editor.setModel(oldModel);
@@ -213,7 +215,7 @@ window.blazorMonaco.editor = {
},
getModel: function (uriStr) {
- var model = this.model.getJsObject(uriStr);
+ var model = this.model.getModel(uriStr);
if (model == null)
return null;
@@ -237,7 +239,7 @@ window.blazorMonaco.editor = {
},
setModelLanguage: function (uriStr, languageId) {
- var model = this.model.getJsObject(uriStr);
+ var model = this.model.getModel(uriStr);
if (model == null)
return null;
return monaco.editor.setModelLanguage(model, languageId);
@@ -248,76 +250,74 @@ window.blazorMonaco.editor = {
return true;
},
- //#endregion
-
- //#region Instance methods
-
- getEditorById: function (id, unobstrusive = false) {
+ getEditorHolder: function (id, unobstrusive = false) {
let editorHolder = window.blazorMonaco.editors.find(e => e.id === id);
if (!editorHolder) {
- if (unobstrusive) return null;
+ if (unobstrusive) {
+ console.log("WARNING : Couldn't find the editor with id: " + id + " editors.length: " + window.blazorMonaco.editors.length);
+ return null;
+ }
throw "Couldn't find the editor with id: " + id + " editors.length: " + window.blazorMonaco.editors.length;
}
else if (!editorHolder.editor) {
- if (unobstrusive) return null;
+ if (unobstrusive) {
+ console.log("WARNING : editor is null for editorHolder: " + editorHolder);
+ return null;
+ }
throw "editor is null for editorHolder: " + editorHolder;
}
- return editorHolder.editor;
+ return editorHolder;
},
- getEditorHolderById: function (id, unobstrusive = false) {
- let editorHolder = window.blazorMonaco.editors.find(e => e.id === id);
- if (!editorHolder) {
- if (unobstrusive) return null;
- throw "Couldn't find the editor with id: " + id + " editors.length: " + window.blazorMonaco.editors.length;
- }
- else if (!editorHolder.editor) {
- if (unobstrusive) return null;
- throw "editor is null for editorHolder: " + editorHolder;
- }
- return editorHolder;
+ getEditor: function (id, unobstrusive = false) {
+ let editorHolder = this.getEditorHolder(id, unobstrusive);
+ return editorHolder == null ? null : editorHolder.editor;
},
- addAction: function (id, actionId, label, keybindings, precondition, keybindingContext, contextMenuGroupId, contextMenuOrder) {
- let editorHolder = this.getEditorHolderById(id);
+ //#endregion
+
+ //#region Instance methods
+
+ addAction: function (id, actionDescriptor) {
+ let editorHolder = this.getEditorHolder(id);
editorHolder.editor.addAction({
- id: actionId,
- label: label,
- keybindings: keybindings,
- precondition: precondition,
- keybindingContext: keybindingContext,
- contextMenuGroupId: contextMenuGroupId,
- contextMenuOrder: contextMenuOrder,
- run: function () {
- editorHolder.dotnetRef.invokeMethodAsync("ActionCallback", keybindings.join(';'));
+ id: actionDescriptor.id,
+ label: actionDescriptor.label,
+ keybindings: actionDescriptor.keybindings,
+ precondition: actionDescriptor.precondition,
+ keybindingContext: actionDescriptor.keybindingContext,
+ contextMenuGroupId: actionDescriptor.contextMenuGroupId,
+ contextMenuOrder: actionDescriptor.contextMenuOrder,
+ run: function (editor, args) {
+ editorHolder.dotnetRef.invokeMethodAsync("ActionCallback", actionDescriptor.id);
}
});
},
- addCommand: function (id, keyCode) {
- let editorHolder = this.getEditorHolderById(id);
- editorHolder.editor.addCommand(keyCode, function () {
- editorHolder.dotnetRef.invokeMethodAsync("CommandCallback", keyCode);
- });
+ addCommand: function (id, keybinding, context) {
+ let editorHolder = this.getEditorHolder(id);
+ editorHolder.editor.addCommand(keybinding, function (args) {
+ editorHolder.dotnetRef.invokeMethodAsync("CommandCallback", keybinding);
+ }, context);
},
deltaDecorations: function (id, oldDecorations, newDecorations) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
return editor.deltaDecorations(oldDecorations, newDecorations);
},
dispose: function (id) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.dispose();
},
focus: function (id) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.focus();
},
executeEdits: function (id, source, edits, endCursorState) {
- let editorHolder = this.getEditorHolderById(id);
+ let editorHolder = this.getEditorHolder(id);
if (endCursorState == "function") {
endCursorState = (inverseEditOperations) => {
return editorHolder.dotnetRef.invokeMethod("ExecuteEditsCallback", inverseEditOperations);
@@ -327,7 +327,7 @@ window.blazorMonaco.editor = {
},
getContainerDomNodeId: function (id) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
let containerNode = editor.getContainerDomNode();
if (containerNode == null)
return null;
@@ -335,22 +335,30 @@ window.blazorMonaco.editor = {
},
getContentHeight: function (id) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
return editor.getContentHeight();
},
getContentWidth: function (id) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
return editor.getContentWidth();
},
+ getDomNodeId: function (id) {
+ let editor = this.getEditor(id);
+ let domeNode = editor.getDomNode();
+ if (domeNode == null)
+ return null;
+ return domeNode.id;
+ },
+
getEditorType: function (id) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
return editor.getEditorType();
},
getInstanceModel: function (id) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
var model = editor.getModel();
if (model == null)
return null;
@@ -362,7 +370,7 @@ window.blazorMonaco.editor = {
},
getInstanceDiffModel: function (id) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
var model = editor.getModel();
if (model == null)
return null;
@@ -380,206 +388,221 @@ window.blazorMonaco.editor = {
},
getLayoutInfo: function (id) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
return editor.getLayoutInfo();
},
getOffsetForColumn: function (id, lineNumber, column) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
return editor.getOffsetForColumn(lineNumber, column);
},
getOption: function (id, optionId) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
return JSON.stringify(editor.getOption(optionId));
},
getOptions: function (id) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
return editor.getOptions()._values.map(function (value) {
return JSON.stringify(value);
});
},
getPosition: function (id) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
return editor.getPosition();
},
getRawOptions: function (id) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
return editor.getRawOptions();
},
getScrollHeight: function (id) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
return editor.getScrollHeight();
},
getScrollLeft: function (id) {
- let editor = this.getEditorById(id);
- return editor.getScrollHeight();
+ let editor = this.getEditor(id);
+ return editor.getScrollLeft();
},
getScrollTop: function (id) {
- let editor = this.getEditorById(id);
- return editor.getScrollHeight();
+ let editor = this.getEditor(id);
+ return editor.getScrollTop();
},
getScrollWidth: function (id) {
- let editor = this.getEditorById(id);
- return editor.getScrollHeight();
+ let editor = this.getEditor(id);
+ return editor.getScrollWidth();
},
getScrolledVisiblePosition: function (id, position) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
return editor.getScrolledVisiblePosition(position);
},
getSelection: function (id) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
return editor.getSelection();
},
getSelections: function (id) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
return editor.getSelections();
},
getTargetAtClientPoint: function (id, clientX, clientY) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
return editor.getTargetAtClientPoint(clientX, clientY);
},
getTopForLineNumber: function (id, lineNumber) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
return editor.getTopForLineNumber(lineNumber);
},
getTopForPosition: function (id, lineNumber, column) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
return editor.getTopForPosition(lineNumber, column);
},
- getValue: function (id) {
- let editor = this.getEditorById(id);
- return editor.getValue();
+ getValue: function (id, preserveBOM, lineEnding) {
+ let editor = this.getEditor(id);
+ let options = null;
+ if (preserveBOM != null && lineEnding != null) {
+ options = {
+ preserveBOM: preserveBOM,
+ lineEnding: lineEnding
+ };
+ }
+ return editor.getValue(options);
},
getVisibleColumnFromPosition: function (id, position) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
return editor.getVisibleColumnFromPosition(position);
},
getVisibleRanges: function (id) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
return editor.getVisibleRanges();
},
hasTextFocus: function (id) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
return editor.hasTextFocus();
},
hasWidgetFocus: function (id) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
return editor.hasWidgetFocus();
},
layout: function (id, dimension) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.layout(dimension);
},
pushUndoStop: function (id) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
return editor.pushUndoStop();
},
+ popUndoStop: function (id) {
+ let editor = this.getEditor(id);
+ return editor.popUndoStop();
+ },
+
render: function (id, forceRedraw) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.render(forceRedraw);
},
revealLine: function (id, lineNumber, scrollType) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.revealLine(lineNumber, scrollType);
},
revealLineInCenter: function (id, lineNumber, scrollType) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.revealLineInCenter(lineNumber, scrollType);
},
revealLineInCenterIfOutsideViewport: function (id, lineNumber, scrollType) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.revealLineInCenterIfOutsideViewport(lineNumber, scrollType);
},
revealLines: function (id, startLineNumber, endLineNumber, scrollType) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.revealLine(startLineNumber, endLineNumber, scrollType);
},
revealLinesInCenter: function (id, startLineNumber, endLineNumber, scrollType) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.revealLinesInCenter(startLineNumber, endLineNumber, scrollType);
},
revealLinesInCenterIfOutsideViewport: function (id, startLineNumber, endLineNumber, scrollType) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.revealLinesInCenterIfOutsideViewport(startLineNumber, endLineNumber, scrollType);
},
revealPosition: function (id, position, scrollType) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.revealPosition(position, scrollType);
},
revealPositionInCenter: function (id, position, scrollType) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.revealPositionInCenter(position, scrollType);
},
revealPositionInCenterIfOutsideViewport: function (id, position, scrollType) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.revealPositionInCenterIfOutsideViewport(position, scrollType);
},
revealRange: function (id, range, scrollType) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.revealRange(range, scrollType);
},
revealRangeAtTop: function (id, range, scrollType) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.revealRangeAtTop(range, scrollType);
},
revealRangeInCenter: function (id, range, scrollType) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.revealRangeInCenter(range, scrollType);
},
revealRangeInCenterIfOutsideViewport: function (id, range, scrollType) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.revealRangeInCenterIfOutsideViewport(range, scrollType);
},
setEventListener: function (id, eventName) {
- let editorHolder = this.getEditorHolderById(id);
+ let editorHolder = this.getEditorHolder(id);
let editor = editorHolder.editor;
let dotnetRef = editorHolder.dotnetRef;
let listener = function (e) {
- var params = JSON.stringify(e);
+ var eventJson = JSON.stringify(e);
if (eventName == "OnDidChangeModel") {
- params = JSON.stringify({
+ eventJson = JSON.stringify({
oldModelUri: e.oldModelUrl == null ? null : e.oldModelUrl.toString(),
newModelUri: e.newModelUrl == null ? null : e.newModelUrl.toString(),
});
}
- dotnetRef.invokeMethodAsync("EventCallback", eventName, params);
+ else if (eventName == "OnDidChangeConfiguration") {
+ eventJson = JSON.stringify(e._values);
+ }
+ dotnetRef.invokeMethodAsync("EventCallback", eventName, eventJson);
};
switch (eventName) {
@@ -614,21 +637,21 @@ window.blazorMonaco.editor = {
},
setInstanceModel: function (id, uriStr) {
- var model = this.model.getJsObject(uriStr);
+ var model = this.model.getModel(uriStr);
if (model == null)
return;
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.setModel(model);
},
setInstanceDiffModel: function (id, model) {
- var original_model = this.model.getJsObject(model.original.uri);
- var modified_model = this.model.getJsObject(model.modified.uri);
+ var original_model = this.model.getModel(model.original.uri);
+ var modified_model = this.model.getModel(model.modified.uri);
if (original_model == null || modified_model == null)
return;
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.setModel({
original: original_model,
modified: modified_model,
@@ -636,50 +659,47 @@ window.blazorMonaco.editor = {
},
setPosition: function (id, position) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.setPosition(position);
},
setScrollLeft: function (id, newScrollLeft, scrollType) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.setScrollLeft(newScrollLeft, scrollType);
},
- setScrollPosition: function (id, newScrollLeft, newScrollTop, scrollType) {
- let editor = this.getEditorById(id);
- editor.setScrollPosition({
- scrollLeft: newScrollLeft,
- scrollTop: newScrollTop
- }, scrollType);
+ setScrollPosition: function (id, newPosition, scrollType) {
+ let editor = this.getEditor(id);
+ editor.setScrollPosition(newPosition, scrollType);
},
setScrollTop: function (id, newScrollTop, scrollType) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.setScrollTop(newScrollTop, scrollType);
},
setSelection: function (id, selection) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.setSelection(selection);
},
setSelections: function (id, selection) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.setSelections(selection);
},
setValue: function (id, value) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.setValue(value);
},
trigger: function (id, source, handlerId, payload) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.trigger(source, handlerId, payload);
},
updateOptions: function (id, options) {
- let editor = this.getEditorById(id);
+ let editor = this.getEditor(id);
editor.updateOptions(options);
},
@@ -695,7 +715,7 @@ window.blazorMonaco.editor = {
//#region TextModel methods
model: {
- getJsObject: function (uriStr) {
+ getModel: function (uriStr) {
var uri = monaco.Uri.parse(uriStr);
if (uri == null)
return null;
@@ -703,266 +723,255 @@ window.blazorMonaco.editor = {
},
getOptions: function (uriStr) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getOptions();
},
getVersionId: function (uriStr) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getVersionId();
},
getAlternativeVersionId: function (uriStr) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getAlternativeVersionId();
},
setValue: function (uriStr, newValue) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.setValue(newValue);
},
getValue: function (uriStr, eol, preserveBOM) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getValue(eol, preserveBOM);
},
getValueLength: function (uriStr, eol, preserveBOM) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getValueLength(eol, preserveBOM);
},
getValueInRange: function (uriStr, range, eol) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getValueInRange(range, eol);
},
getValueLengthInRange: function (uriStr, range) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getValueLengthInRange(range);
},
getCharacterCountInRange: function (uriStr, range) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getCharacterCountInRange(range);
},
getLineCount: function (uriStr) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getLineCount();
},
getLineContent: function (uriStr, lineNumber) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getLineContent(lineNumber);
},
getLineLength: function (uriStr, lineNumber) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getLineLength(lineNumber);
},
getLinesContent: function (uriStr) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getLinesContent();
},
getEOL: function (uriStr) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getEOL();
},
getEndOfLineSequence: function (uriStr) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getEndOfLineSequence();
},
getLineMinColumn: function (uriStr, lineNumber) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getLineMinColumn(lineNumber);
},
getLineMaxColumn: function (uriStr, lineNumber) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getLineMaxColumn(lineNumber);
},
getLineFirstNonWhitespaceColumn: function (uriStr, lineNumber) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getLineFirstNonWhitespaceColumn(lineNumber);
},
getLineLastNonWhitespaceColumn: function (uriStr, lineNumber) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getLineLastNonWhitespaceColumn(lineNumber);
},
validatePosition: function (uriStr, position) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.validatePosition(position);
},
modifyPosition: function (uriStr, position, offset) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.modifyPosition(position, offset);
},
validateRange: function (uriStr, range) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.validateRange(range);
},
getOffsetAt: function (uriStr, position) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getOffsetAt(position);
},
getPositionAt: function (uriStr, offset) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getPositionAt(offset);
},
getFullModelRange: function (uriStr) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getFullModelRange();
},
isDisposed: function (uriStr) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.isDisposed();
},
findMatches: function (uriStr, searchString, searchScope_or_searchOnlyEditableRange, isRegex, matchCase, wordSeparators, captureMatches, limitResultCount) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.findMatches(searchString, searchScope_or_searchOnlyEditableRange, isRegex, matchCase, wordSeparators, captureMatches, limitResultCount);
},
findNextMatch: function (uriStr, searchString, searchStart, isRegex, matchCase, wordSeparators, captureMatches) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.findNextMatch(searchString, searchStart, isRegex, matchCase, wordSeparators, captureMatches);
},
findPreviousMatch: function (uriStr, searchString, searchStart, isRegex, matchCase, wordSeparators, captureMatches) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.findPreviousMatch(searchString, searchStart, isRegex, matchCase, wordSeparators, captureMatches);
},
getLanguageId: function (uriStr) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getLanguageId();
},
getWordAtPosition: function (uriStr, position) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getWordAtPosition(position);
},
getWordUntilPosition: function (uriStr, position) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getWordUntilPosition(position);
},
deltaDecorations: function (uriStr, oldDecorations, newDecorations, ownerId) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.deltaDecorations(oldDecorations, newDecorations, ownerId);
},
getDecorationOptions: function (uriStr, id) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getDecorationOptions(id);
},
getDecorationRange: function (uriStr, id) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getDecorationRange(id);
},
getLineDecorations: function (uriStr, lineNumber, ownerId, filterOutValidation) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getLineDecorations(lineNumber, ownerId, filterOutValidation);
},
getLinesDecorations: function (uriStr, startLineNumber, endLineNumber, ownerId, filterOutValidation) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getLinesDecorations(startLineNumber, endLineNumber, ownerId, filterOutValidation);
},
getDecorationsInRange: function (uriStr, range, ownerId, filterOutValidation) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getDecorationsInRange(range, ownerId, filterOutValidation);
},
- getDecorationsInRange2: function (uriStr, range) {
- let model = this.getJsObject(uriStr);
- return model.getDecorationsInRange(range);
- },
-
getAllDecorations: function (uriStr, ownerId, filterOutValidation) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getAllDecorations(ownerId, filterOutValidation);
},
getInjectedTextDecorations: function (uriStr, ownerId) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getInjectedTextDecorations(ownerId);
},
getOverviewRulerDecorations: function (uriStr, ownerId, filterOutValidation) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.getOverviewRulerDecorations(ownerId, filterOutValidation);
},
normalizeIndentation: function (uriStr, str) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.normalizeIndentation(str);
},
updateOptions: function (uriStr, newOpts) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.updateOptions(newOpts);
},
detectIndentation: function (uriStr, defaultInsertSpaces, defaultTabSize) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.detectIndentation(defaultInsertSpaces, defaultTabSize);
},
pushStackElement: function (uriStr) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.pushStackElement();
},
popStackElement: function (uriStr) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.popStackElement();
},
pushEOL: function (uriStr, eol) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.pushEOL(eol);
},
- applyEdits: function (uriStr, operations) {
- let model = this.getJsObject(uriStr);
- return model.applyEdits(operations);
- },
-
applyEdits: function (uriStr, operations, computeUndoEdits) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.applyEdits(operations, computeUndoEdits);
},
setEOL: function (uriStr, eol) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.setEOL(eol);
},
dispose: function (uriStr) {
- let model = this.getJsObject(uriStr);
+ let model = this.getModel(uriStr);
return model.dispose();
}
}
//#endregion
-}
-
+}
\ No newline at end of file