feat: Initial clean release of CHM
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
这个提交包含在:
@@ -0,0 +1,188 @@
|
||||
import { EditorCommandType } from '@joplin/editor/types';
|
||||
import { _ } from '@joplin/lib/locale';
|
||||
import { CommandDeclaration } from '@joplin/lib/services/CommandService';
|
||||
|
||||
const markdownEditorOnlyCommands = [
|
||||
EditorCommandType.ToggleBlockQuote,
|
||||
EditorCommandType.DuplicateLine,
|
||||
EditorCommandType.SortSelectedLines,
|
||||
EditorCommandType.SwapLineUp,
|
||||
EditorCommandType.SwapLineDown,
|
||||
].map(command => `editor.${command}`);
|
||||
|
||||
|
||||
|
||||
const richTextEditorOnlyCommands = [
|
||||
EditorCommandType.InsertCodeBlock,
|
||||
].map(command => `editor.${command}`);
|
||||
|
||||
export const visibleCondition = (commandName: string) => {
|
||||
const output = [];
|
||||
|
||||
if (markdownEditorOnlyCommands.includes(commandName)) {
|
||||
output.push('!richTextEditorVisible');
|
||||
}
|
||||
|
||||
if (richTextEditorOnlyCommands.includes(commandName)) {
|
||||
output.push('!markdownEditorPaneVisible');
|
||||
}
|
||||
|
||||
return output.join(' && ');
|
||||
};
|
||||
|
||||
export const enabledCondition = (commandName: string) => {
|
||||
return [
|
||||
visibleCondition(commandName), '!noteIsReadOnly',
|
||||
].filter(c => !!c).join('&&');
|
||||
};
|
||||
|
||||
const headerDeclarations = () => {
|
||||
const result: CommandDeclaration[] = [];
|
||||
for (let level = 1; level <= 5; level++) {
|
||||
result.push({
|
||||
name: `editor.textHeading${level}`,
|
||||
iconName: `material format-header-${level}`,
|
||||
label: () => _('Header %d', level),
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
const declarations: CommandDeclaration[] = [
|
||||
{
|
||||
name: 'insertText',
|
||||
},
|
||||
{
|
||||
name: 'editor.undo',
|
||||
},
|
||||
{
|
||||
name: 'editor.redo',
|
||||
},
|
||||
{
|
||||
name: 'selectedText',
|
||||
},
|
||||
{
|
||||
name: 'replaceSelection',
|
||||
},
|
||||
{
|
||||
name: 'editor.setText',
|
||||
},
|
||||
{
|
||||
name: 'editor.focus',
|
||||
},
|
||||
{
|
||||
name: 'editor.execCommand',
|
||||
},
|
||||
|
||||
{
|
||||
name: EditorCommandType.ToggleBolded,
|
||||
label: () => _('Bold'),
|
||||
iconName: 'material format-bold',
|
||||
},
|
||||
{
|
||||
name: EditorCommandType.ToggleItalicized,
|
||||
label: () => _('Italic'),
|
||||
iconName: 'material format-italic',
|
||||
},
|
||||
...headerDeclarations(),
|
||||
{
|
||||
name: EditorCommandType.ToggleCode,
|
||||
label: () => _('Code'),
|
||||
iconName: 'material code-json',
|
||||
},
|
||||
{
|
||||
// The 'editor.' prefix needs to be included because ToggleMath is not a legacy
|
||||
// editor command. Without this, ToggleMath is not recognised as an editor command.
|
||||
name: `editor.${EditorCommandType.ToggleMath}`,
|
||||
label: () => _('Math'),
|
||||
iconName: 'material sigma',
|
||||
},
|
||||
{
|
||||
name: EditorCommandType.ToggleNumberedList,
|
||||
label: () => _('Ordered list'),
|
||||
iconName: 'material format-list-numbered',
|
||||
},
|
||||
{
|
||||
name: EditorCommandType.ToggleBulletedList,
|
||||
label: () => _('Unordered list'),
|
||||
iconName: 'material format-list-bulleted',
|
||||
},
|
||||
{
|
||||
name: EditorCommandType.ToggleCheckList,
|
||||
label: () => _('Task list'),
|
||||
iconName: 'material format-list-checks',
|
||||
},
|
||||
{
|
||||
name: `editor.${EditorCommandType.ToggleBlockQuote}`,
|
||||
label: () => _('Blockquote'),
|
||||
iconName: 'material format-quote-close',
|
||||
},
|
||||
{
|
||||
name: `editor.${EditorCommandType.InsertTable}`,
|
||||
label: () => _('Table'),
|
||||
iconName: 'material table',
|
||||
},
|
||||
{
|
||||
name: `editor.${EditorCommandType.InsertCodeBlock}`,
|
||||
label: () => _('Block code'),
|
||||
iconName: 'material code-tags',
|
||||
},
|
||||
{
|
||||
name: EditorCommandType.IndentLess,
|
||||
label: () => _('Decrease indent level'),
|
||||
iconName: 'material format-indent-decrease',
|
||||
},
|
||||
{
|
||||
name: EditorCommandType.IndentMore,
|
||||
label: () => _('Increase indent level'),
|
||||
iconName: 'material format-indent-increase',
|
||||
},
|
||||
{
|
||||
name: `editor.${EditorCommandType.SwapLineDown}`,
|
||||
label: () => _('Swap line down'),
|
||||
iconName: 'material chevron-double-down',
|
||||
},
|
||||
{
|
||||
name: `editor.${EditorCommandType.SwapLineUp}`,
|
||||
label: () => _('Swap line up'),
|
||||
iconName: 'material chevron-double-up',
|
||||
},
|
||||
{
|
||||
name: `editor.${EditorCommandType.DeleteLine}`,
|
||||
label: () => _('Delete line'),
|
||||
iconName: 'material close',
|
||||
},
|
||||
{
|
||||
name: `editor.${EditorCommandType.DuplicateLine}`,
|
||||
label: () => _('Duplicate line'),
|
||||
iconName: 'material content-duplicate',
|
||||
},
|
||||
{
|
||||
name: `editor.${EditorCommandType.SortSelectedLines}`,
|
||||
label: () => _('Sort selected lines'),
|
||||
iconName: 'material sort-alphabetical-ascending',
|
||||
},
|
||||
{
|
||||
name: EditorCommandType.ToggleSearch,
|
||||
label: () => _('Search'),
|
||||
iconName: 'material magnify',
|
||||
},
|
||||
{
|
||||
name: EditorCommandType.EditLink,
|
||||
label: () => _('Link'),
|
||||
iconName: 'material link',
|
||||
},
|
||||
{
|
||||
name: `editor.${EditorCommandType.GoDocStart}`,
|
||||
label: () => _('Go to start of note'),
|
||||
iconName: 'material page-first',
|
||||
},
|
||||
{
|
||||
name: `editor.${EditorCommandType.GoDocEnd}`,
|
||||
label: () => _('Go to end of note'),
|
||||
iconName: 'material page-last',
|
||||
},
|
||||
];
|
||||
|
||||
export default declarations;
|
||||
在新工单中引用
屏蔽一个用户