Browse Source

v1.1.4: fix meta key support (mac)

CrazyDoctor 2 months ago
parent
commit
f29166f7c0
3 changed files with 7 additions and 6 deletions
  1. 1 1
      package.json
  2. 2 1
      static/CDClientLib/CDClientLib.js
  3. 4 4
      static/page/class/script.js

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
 	"name": "doczilla_js_docs",
 	"name": "doczilla_js_docs",
-	"version": "1.1.3",
+	"version": "1.1.4",
 	"dependencies": {
 	"dependencies": {
 		"@types/sqlite3": "^3.1.11",
 		"@types/sqlite3": "^3.1.11",
 		"@types/ws": "^8.5.10",
 		"@types/ws": "^8.5.10",

+ 2 - 1
static/CDClientLib/CDClientLib.js

@@ -467,7 +467,8 @@ class DOM {
 		Escape: 'Escape',
 		Escape: 'Escape',
 		Control: 'Control',
 		Control: 'Control',
 		Shift: 'Shift',
 		Shift: 'Shift',
-		Backspace: 'Backspace'
+		Backspace: 'Backspace',
+		Meta: 'Meta'
 	};
 	};
 
 
 	static MouseButtons = {
 	static MouseButtons = {

+ 4 - 4
static/page/class/script.js

@@ -1208,18 +1208,18 @@ window_.on(DOM.Events.Load, (e) => {
 window_.on(DOM.Events.KeyDown, (e) => {
 window_.on(DOM.Events.KeyDown, (e) => {
 	if(Class.isPackage)
 	if(Class.isPackage)
 		return;
 		return;
-	if(window.page && (e.ctrlKey || e.metaKey))
+	if(window.page && (e.key === DOM.Keys.Control || e.key === DOM.Keys.Meta))
 		window.page.codeMirrorEditorElement.addClass(ClassPage.StyleClasses.CtrlPressed);
 		window.page.codeMirrorEditorElement.addClass(ClassPage.StyleClasses.CtrlPressed);
-	if(window.page && e.shiftKey)
+	if(window.page && e.key === DOM.Keys.Shift)
 		window.page.codeMirrorEditorElement.addClass(ClassPage.StyleClasses.ShiftPressed);
 		window.page.codeMirrorEditorElement.addClass(ClassPage.StyleClasses.ShiftPressed);
 });
 });
 
 
 window_.on(DOM.Events.KeyUp, (e) => {
 window_.on(DOM.Events.KeyUp, (e) => {
 	if(Class.isPackage)
 	if(Class.isPackage)
 		return;
 		return;
-	if(window.page && (e.ctrlKey || e.metaKey))
+	if(window.page && (e.key === DOM.Keys.Control || e.key === DOM.Keys.Meta))
 		window.page.codeMirrorEditorElement.removeClass(ClassPage.StyleClasses.CtrlPressed);
 		window.page.codeMirrorEditorElement.removeClass(ClassPage.StyleClasses.CtrlPressed);
-	if(window.page && e.shiftKey)
+	if(window.page && e.key === DOM.Keys.Shift)
 		window.page.codeMirrorEditorElement.removeClass(ClassPage.StyleClasses.ShiftPressed);
 		window.page.codeMirrorEditorElement.removeClass(ClassPage.StyleClasses.ShiftPressed);
 });
 });