一些检查失败了
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
31 行
878 B
TypeScript
31 行
878 B
TypeScript
import { EditorView } from '@codemirror/view';
|
|
import modifierKeyCssExtension from './modifierKeyCssExtension';
|
|
import { syntaxTree } from '@codemirror/language';
|
|
import getCheckboxAtPosition from '../utils/markdown/getCheckboxAtPosition';
|
|
import toggleCheckboxAt from '../utils/markdown/toggleCheckboxAt';
|
|
import ctrlClickActionExtension from './ctrlClickActionExtension';
|
|
|
|
|
|
const ctrlClickCheckboxExtension = () => {
|
|
return [
|
|
modifierKeyCssExtension,
|
|
EditorView.theme({
|
|
'&.-ctrl-or-cmd-pressed .cm-taskMarker': {
|
|
cursor: 'pointer',
|
|
},
|
|
}),
|
|
ctrlClickActionExtension((view, event) => {
|
|
const target = view.posAtCoords(event);
|
|
const taskMarker = getCheckboxAtPosition(target, syntaxTree(view.state));
|
|
|
|
if (taskMarker) {
|
|
toggleCheckboxAt(target)(view);
|
|
return true;
|
|
}
|
|
return false;
|
|
}),
|
|
];
|
|
};
|
|
|
|
export default ctrlClickCheckboxExtension;
|