Skip to content
Open

0.7.2 #275

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
25503ee
[Env] Bump version to `0.7.2`
Bistard Feb 25, 2025
c5f41e0
[Rename] from `editorCommands.ts` to `command.contrib.ts`
Bistard Feb 25, 2025
d12e445
[Chore] abstract out a new file `editorCommand.ts`
Bistard Feb 25, 2025
c360c27
[Chore]
Bistard Feb 25, 2025
730c25d
[Fix] typo
Bistard Feb 26, 2025
618793f
[Feat] list operation (split, lift, sink)
Bistard Feb 26, 2025
e72c356
[Refactor] improve shortcut handling by prioritizing valid candidates…
Bistard Feb 26, 2025
c7d368a
[Feat] enhance shortcut command execution by allowing commandArgs to …
Bistard Feb 26, 2025
885b658
[Fix] disable shortcut saving mechanism
Bistard Feb 26, 2025
941260a
[Refactor] update shortcut registration to support multiple shortcuts
Bistard Feb 26, 2025
1d1c8c5
[Refactor] editor command are directly regisered in and triggered by …
Bistard Feb 26, 2025
6c5c813
Merge pull request #274 from Bistard/dev-list
Bistard Feb 26, 2025
b69117d
[Refactor] update keyboard event handling to improve command executio…
Bistard Feb 26, 2025
75a6003
[Feat] add unique ID for `EditorWidget`
Bistard Feb 26, 2025
2cfef55
[Feat] `IEditorService` for tracking editor lifecycle and events
Bistard Feb 26, 2025
2bcb4b9
[Feat] tracking `EditorWidget` lifecycle
Bistard Feb 26, 2025
ec64bd0
[Fix] register `IEditorService` as a core service
Bistard Feb 26, 2025
3db7e1d
[Refactor] `EditorCommand` is executed based on the context of the cu…
Bistard Feb 26, 2025
ff84c13
[Refactor] remove deprecated `EditorCommandExtension`
Bistard Feb 26, 2025
b99a346
[Chore]
Bistard Feb 27, 2025
2e4d544
[Fix] properly editor context key expr
Bistard Feb 27, 2025
9d4012e
Merge pull request #276 from Bistard/dev-remove-command-extension
Bistard Feb 27, 2025
b3622b5
[Fix] enhance error logging to ensure printed errors are interactive
Bistard Feb 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"version": "0.7.1",
"version": "0.7.2",
"contents": {
"editor/common/markdown": {
"code": "Code",
Expand Down
2 changes: 1 addition & 1 deletion assets/locale/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"--------------------------------------------------------------------------------------------",
"Do not edit this file. It is machine generated."
],
"version": "0.7.1",
"version": "0.7.2",
"contents": {
"platform/i18n/browser/i18nService": {
"relaunchDisplayLanguageMessage": "重新启动 {name} 以切换到语言:{languageName}?"
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nota",
"version": "0.7.1",
"version": "0.7.2",
"description": "A cross-platform markdown note-taking app.",
"main": "./dist/main-bundle.js",
"type": "commonjs",
Expand Down
2 changes: 1 addition & 1 deletion product.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"projectName": "nota",
"applicationName": "nota",
"description": "A cross-platform markdown note-taking app.",
"version": "0.7.1",
"version": "0.7.2",
"license": "MIT"
}
3 changes: 3 additions & 0 deletions src/base/common/keyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,14 +534,17 @@ export class Shortcut {
} else if (lowerPart === 'meta' || lowerPart === 'cmd') {
shortcut.meta = true;
} else {
// duplicate main key found, we consider it as invalid shortcut.
if (shortcut.key !== KeyCode.None) {
console.warn(`Invalid shortcut string (${string})`);
return Shortcut.None;
}

const key = Keyboard.toKeyCode(part);
if (key !== KeyCode.None) {
shortcut.key = key;
} else {
console.warn(`Invalid shortcut string (${string})`);
return Shortcut.None;
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/base/common/utilities/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ export type Push<Arr extends any[], V> = [...Arr, V];
*/
export type Pop<Arr extends any[]> = Arr extends [...infer Rest, any] ? Rest : never;

/**
* Remove the first of the array (require non empty).
*/
export type Shift<Arr extends any[]> = Arr extends [any, ...infer Rest] ? Rest : never;

/**
* Converts a two-dimensional array type to a one-dimensional array type.
*/
Expand Down
8 changes: 8 additions & 0 deletions src/code/browser/renderer.desktop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ import { INotificationService } from "src/workbench/services/notification/notifi
import { IEncryptionService } from "src/platform/encryption/common/encryptionService";
import { BrowserAITextChannel } from "src/platform/ai/common/aiTextChannel";
import { IAITextService } from "src/platform/ai/common/aiText";
import { IEditorService } from "src/workbench/services/editor/editor";
import { EditorService } from "src/workbench/services/editor/editorService";
import { rendererEditorCommandRegister } from "src/editor/contrib/command/command.register";

/**
* @class This is the main entry of the renderer process.
Expand Down Expand Up @@ -148,6 +151,10 @@ const renderer = new class extends class RendererInstance extends Disposable {
const contextService = new ContextService();
instantiationService.store(IContextService, contextService);

// editor-service
const editorService = new EditorService();
instantiationService.store(IEditorService, editorService);

// registrant-service
const registrantService = instantiationService.createInstance(RegistrantService);
instantiationService.store(IRegistrantService, registrantService);
Expand Down Expand Up @@ -321,6 +328,7 @@ const renderer = new class extends class RendererInstance extends Disposable {
[
rendererWorkbenchCommandRegister,
rendererTitleBarFileCommandRegister,
rendererEditorCommandRegister,
]
.forEach(register => register(provider));
}
Expand Down
7 changes: 6 additions & 1 deletion src/editor/common/editorContextKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ import { CreateContextKeyExpr } from "src/platform/context/common/contextKeyExpr

export namespace EditorContextKeys {
export const editorFocusedContext = CreateContextKeyExpr.Equal('isEditorFocused', true);
export const isEditorReadonly = CreateContextKeyExpr.Equal('isEditorReadonly', true);
export const isEditorWritable = CreateContextKeyExpr.Equal('isEditorWritable', true);
export const isEditorEditable = CreateContextKeyExpr.And(editorFocusedContext, isEditorWritable);
export const isEditorReadonly = CreateContextKeyExpr.Or(
CreateContextKeyExpr.Equal('isEditorReadonly', true),
isEditorWritable,
);
export const isEditorNotEditable = CreateContextKeyExpr.And(editorFocusedContext, isEditorReadonly);
export const richtextEditorMode = CreateContextKeyExpr.Equal('editorRenderMode', EditorType.Rich);
export const plaintextEditorMode = CreateContextKeyExpr.Equal('editorRenderMode', EditorType.Plain);
export const splitViewEditorMode = CreateContextKeyExpr.Equal('editorRenderMode', EditorType.Split);
Expand Down
1 change: 1 addition & 0 deletions src/editor/common/proseMirror.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Selection } from "prosemirror-state";
export {
Step as ProseStep,
ReplaceStep as ProseReplaceStep,
ReplaceAroundStep as ProseReplaceAroundStep,
Mapping as ProseMapping,
StepMap as ProseStepMapping,
} from "prosemirror-transform";
Expand Down
3 changes: 0 additions & 3 deletions src/editor/contrib/builtInExtensionList.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Constructor } from "src/base/common/utilities/type";
import { EditorExtension } from "src/editor/common/editorExtension";
import { EditorCommandExtension } from "src/editor/contrib/command/command";
import { EditorAutoSaveExtension } from "src/editor/contrib/autoSave";
import { EditorSnippetExtension } from "src/editor/contrib/snippet/snippet";
import { EditorDragAndDropExtension } from "src/editor/contrib/dragAndDrop/dragAndDrop";
Expand All @@ -11,7 +10,6 @@ import { EditorAskAIExtension } from "src/editor/contrib/askAI/askAI";
// import { EditorHistoryExtension } from "src/editor/contrib/history/history";

export const enum EditorExtensionIDs {
Command = 'editor-command-extension',
AutoSave = 'editor-autosave-extension',
Snippet = 'editor-snippet-extension',
History = 'editor-history-extension',
Expand All @@ -29,7 +27,6 @@ export function getBuiltInExtension(): { id: string, ctor: Constructor<EditorExt
return [
{ id: EditorExtensionIDs.Snippet, ctor: EditorSnippetExtension },
{ id: EditorExtensionIDs.AutoSave, ctor: EditorAutoSaveExtension },
{ id: EditorExtensionIDs.Command, ctor: EditorCommandExtension },
{ id: EditorExtensionIDs.DragAndDrop, ctor: EditorDragAndDropExtension },
{ id: EditorExtensionIDs.BlockHandle, ctor: EditorBlockHandleExtension },
{ id: EditorExtensionIDs.BlockPlaceHolder, ctor: EditorBlockPlaceHolderExtension },
Expand Down
Loading
Loading