Merge branch 'dev' into dev

pull/12121/head
Aqiel Oostenbrug 2025-04-18 12:46:43 +02:00 committed by GitHub
commit 4ab579b7f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 65 additions and 334 deletions

View File

@ -114,8 +114,8 @@ const useRefreshFormNoteOnChange = (formNoteRef: RefObject<FormNote>, editorId:
const refreshFormNote = useCallback(() => {
// Increase the counter to cancel any ongoing refresh attempts
// and start a new one.
setFormNoteRefreshScheduled(formNoteRefreshScheduled + 1);
}, [formNoteRefreshScheduled]);
setFormNoteRefreshScheduled(count => count + 1);
}, []);
// When switching from the plugin editor to the built-in editor, we refresh the note since the
// plugin may have modified it via the data API.

View File

@ -1,43 +0,0 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const react_1 = require('react');
const markupLanguageUtils_1 = require('@joplin/lib/utils/markupLanguageUtils');
const Setting_1 = require('@joplin/lib/models/Setting');
const shim_1 = require('@joplin/lib/shim');
const { themeStyle } = require('@joplin/lib/theme');
const Note_1 = require('@joplin/lib/models/Note');
const resourceUtils_1 = require('@joplin/lib/models/utils/resourceUtils');
function useMarkupToHtml(deps) {
const { themeId, customCss, plugins, whiteBackgroundNoteRendering } = deps;
const resourceBaseUrl = (0, react_1.useMemo)(() => {
return `joplin-content://note-viewer/${Setting_1.default.value('resourceDir')}/`;
}, []);
const markupToHtml = (0, react_1.useMemo)(() => {
return markupLanguageUtils_1.default.newMarkupToHtml(plugins, {
resourceBaseUrl,
customCss: customCss || '',
});
}, [plugins, customCss, resourceBaseUrl]);
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
return (0, react_1.useCallback)(async (markupLanguage, md, options = null) => {
options = { replaceResourceInternalToExternalLinks: false, resourceInfos: {}, platformName: shim_1.default.platformName(), ...options };
md = md || '';
const theme = themeStyle(themeId);
let resources = {};
if (options.replaceResourceInternalToExternalLinks) {
md = await Note_1.default.replaceResourceInternalToExternalLinks(md, { useAbsolutePaths: true });
} else {
resources = options.resourceInfos;
}
delete options.replaceResourceInternalToExternalLinks;
const result = await markupToHtml.render(markupLanguage, md, theme, { codeTheme: theme.codeThemeCss, resources: resources, postMessageSyntax: 'ipcProxySendToHost', splitted: true, externalAssetsOnly: true, codeHighlightCacheKey: 'useMarkupToHtml', settingValue: deps.settingValue, whiteBackgroundNoteRendering, itemIdToUrl: (id, urlParameters = '') => {
if (!(id in resources) || !resources[id]) {
return null;
}
return (0, resourceUtils_1.resourceFullPath)(resources[id].item, resourceBaseUrl) + urlParameters;
}, ...options });
return result;
}, [themeId, markupToHtml, whiteBackgroundNoteRendering, resourceBaseUrl, deps.settingValue]);
}
exports.default = useMarkupToHtml;
// # sourceMappingURL=useMarkupToHtml.js.map

View File

@ -1,19 +0,0 @@
'use strict';
// Based on https://github.com/caroso1222/notyf/blob/master/recipes/react.md
Object.defineProperty(exports, '__esModule', { value: true });
const React = require('react');
const notyf_1 = require('notyf');
const types_1 = require('@joplin/lib/services/plugins/api/types');
exports.default = React.createContext(new notyf_1.Notyf({
// Set your global Notyf configuration here
duration: 6000,
types: [
{
type: types_1.ToastType.Info,
icon: false,
className: 'notyf__toast--info',
background: 'blue', // Need to set a background, otherwise Notyf won't create the background element. But the color will be overriden in CSS.
},
],
}));
// # sourceMappingURL=NotyfContext.js.map

View File

@ -49,6 +49,7 @@ describe('NoteEditor', () => {
themeId={Setting.THEME_ARITIM_DARK}
initialText='Testing...'
noteId=''
noteHash=''
style={{}}
toolbarEnabled={true}
readOnly={false}

View File

@ -42,6 +42,7 @@ interface Props {
themeId: number;
initialText: string;
noteId: string;
noteHash: string;
initialSelection?: SelectionRange;
style: ViewStyle;
toolbarEnabled: boolean;
@ -332,6 +333,9 @@ function NoteEditor(props: Props, ref: any) {
cm.select(${props.initialSelection.start}, ${props.initialSelection.end});
cm.execCommand('scrollSelectionIntoView');
` : '';
const jumpToHashJs = props.noteHash ? `
cm.jumpToHash(${JSON.stringify(props.noteHash)});
` : '';
const editorSettings: EditorSettings = useMemo(() => ({
themeId: props.themeId,
@ -391,6 +395,9 @@ function NoteEditor(props: Props, ref: any) {
settings
);
${jumpToHashJs}
// Set the initial selection after jumping to the header -- the initial selection,
// if specified, should take precedence.
${setInitialSelectionJS}
window.onresize = () => {
@ -425,6 +432,20 @@ function NoteEditor(props: Props, ref: any) {
}
}, [css]);
// Scroll to the new hash, if it changes.
const isFirstScrollRef = useRef(true);
useEffect(() => {
// The first "jump to header" is handled during editor setup and shouldn't
// be handled a second time:
if (isFirstScrollRef.current) {
isFirstScrollRef.current = false;
return;
}
if (jumpToHashJs && webviewRef.current) {
webviewRef.current.injectJS(jumpToHashJs);
}
}, [jumpToHashJs]);
const html = useHtml(css);
const [selectionState, setSelectionState] = useState<SelectionFormatting>(defaultSelectionFormatting);
const [linkDialogVisible, setLinkDialogVisible] = useState(false);

View File

@ -1,34 +0,0 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const React = require('react');
const react_native_1 = require('react-native');
const Modal_1 = require('../Modal');
const react_1 = require('react');
const locale_1 = require('@joplin/lib/locale');
const buttons_1 = require('../buttons');
// react-native-paper's floating action button menu is inaccessible on web
// (can't be activated by a screen reader, and, in some cases, by the tab key).
// This component provides an alternative.
const AccessibleModalMenu = props => {
let _a;
const [open, setOpen] = (0, react_1.useState)(false);
const onClick = (0, react_1.useCallback)(() => {
if (props.onPress) {
props.onPress();
} else {
setOpen(!open);
}
}, [open, props.onPress]);
const options = [];
for (const action of ((_a = props.actions) !== null && _a !== void 0 ? _a : [])) {
options.push(React.createElement(buttons_1.PrimaryButton, { key: action.label, onPress: action.onPress }, action.label));
}
const modal = (React.createElement(Modal_1.default, { visible: open },
options,
React.createElement(buttons_1.SecondaryButton, { onPress: onClick }, (0, locale_1._)('Close menu'))));
return React.createElement(react_native_1.View, { style: { height: 0, overflow: 'visible' } },
modal,
React.createElement(buttons_1.SecondaryButton, { onPress: onClick }, props.label));
};
exports.default = AccessibleModalMenu;
// # sourceMappingURL=AccessibleModalMenu.js.map

View File

@ -1585,6 +1585,7 @@ class NoteScreenComponent extends BaseScreenComponent<ComponentProps, State> imp
toolbarEnabled={this.props.toolbarEnabled}
themeId={this.props.themeId}
noteId={this.props.noteId}
noteHash={this.props.noteHash}
initialText={note.body}
initialSelection={this.selection}
onChange={this.onMarkdownEditorTextChange}

View File

@ -1,233 +0,0 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const React = require('react');
const react_native_1 = require('react-native');
const reducer_1 = require('@joplin/lib/reducer');
const react_redux_1 = require('react-redux');
const NoteList_1 = require('../NoteList');
const Folder_1 = require('@joplin/lib/models/Folder');
const Tag_1 = require('@joplin/lib/models/Tag');
const Note_1 = require('@joplin/lib/models/Note');
const Setting_1 = require('@joplin/lib/models/Setting');
const global_style_1 = require('../global-style');
const ScreenHeader_1 = require('../ScreenHeader');
const locale_1 = require('@joplin/lib/locale');
const FloatingActionButton_1 = require('../buttons/FloatingActionButton');
const base_screen_1 = require('../base-screen');
const trash_1 = require('@joplin/lib/services/trash');
const AccessibleView_1 = require('../accessibility/AccessibleView');
const DialogManager_1 = require('../DialogManager');
const react_1 = require('react');
class NotesScreenComponent extends base_screen_1.BaseScreenComponent {
constructor(props) {
super(props);
this.onAppStateChangeSub_ = null;
this.styles_ = {};
this.onAppStateChange_ = async () => {
// Force an update to the notes list when app state changes
const newProps = { ...this.props };
newProps.notesSource = '';
await this.refreshNotes(newProps);
};
this.sortButton_press = async () => {
const buttons = [];
const sortNoteOptions = Setting_1.default.enumOptions('notes.sortOrder.field');
for (const field in sortNoteOptions) {
if (!sortNoteOptions.hasOwnProperty(field)) { continue; }
buttons.push({
text: sortNoteOptions[field],
iconChecked: 'fas fa-circle',
checked: Setting_1.default.value('notes.sortOrder.field') === field,
id: { name: 'notes.sortOrder.field', value: field },
});
}
buttons.push({
text: `[ ${Setting_1.default.settingMetadata('notes.sortOrder.reverse').label()} ]`,
checked: Setting_1.default.value('notes.sortOrder.reverse'),
id: { name: 'notes.sortOrder.reverse', value: !Setting_1.default.value('notes.sortOrder.reverse') },
});
buttons.push({
text: `[ ${Setting_1.default.settingMetadata('uncompletedTodosOnTop').label()} ]`,
checked: Setting_1.default.value('uncompletedTodosOnTop'),
id: { name: 'uncompletedTodosOnTop', value: !Setting_1.default.value('uncompletedTodosOnTop') },
});
buttons.push({
text: `[ ${Setting_1.default.settingMetadata('showCompletedTodos').label()} ]`,
checked: Setting_1.default.value('showCompletedTodos'),
id: { name: 'showCompletedTodos', value: !Setting_1.default.value('showCompletedTodos') },
});
const r = await this.props.dialogManager.showMenu(Setting_1.default.settingMetadata('notes.sortOrder.field').label(), buttons);
if (!r) { return; }
Setting_1.default.setValue(r.name, r.value);
};
this.newNoteNavigate = async (folderId, isTodo) => {
try {
const newNote = await Note_1.default.save({
parent_id: folderId,
is_todo: isTodo ? 1 : 0,
}, { provisional: true });
this.props.dispatch({
type: 'NAV_GO',
routeName: 'Note',
noteId: newNote.id,
});
} catch (error) {
alert((0, locale_1._)('Cannot create a new note: %s', error.message));
}
};
}
styles() {
if (!this.styles_) { this.styles_ = {}; }
const themeId = this.props.themeId;
const cacheKey = themeId;
if (this.styles_[cacheKey]) { return this.styles_[cacheKey]; }
this.styles_ = {};
const styles = {
noteList: {
flex: 1,
},
};
this.styles_[cacheKey] = react_native_1.StyleSheet.create(styles);
return this.styles_[cacheKey];
}
async componentDidMount() {
await this.refreshNotes();
this.onAppStateChangeSub_ = react_native_1.AppState.addEventListener('change', this.onAppStateChange_);
}
async componentWillUnmount() {
if (this.onAppStateChangeSub_) { this.onAppStateChangeSub_.remove(); }
}
async componentDidUpdate(prevProps) {
if (prevProps.notesOrder !== this.props.notesOrder || prevProps.selectedFolderId !== this.props.selectedFolderId || prevProps.selectedTagId !== this.props.selectedTagId || prevProps.selectedSmartFilterId !== this.props.selectedSmartFilterId || prevProps.notesParentType !== this.props.notesParentType || prevProps.uncompletedTodosOnTop !== this.props.uncompletedTodosOnTop || prevProps.showCompletedTodos !== this.props.showCompletedTodos) {
await this.refreshNotes(this.props);
}
}
async refreshNotes(props = null) {
if (props === null) { props = this.props; }
const options = {
order: props.notesOrder,
uncompletedTodosOnTop: props.uncompletedTodosOnTop,
showCompletedTodos: props.showCompletedTodos,
caseInsensitive: true,
};
const parent = this.parentItem(props);
if (!parent) { return; }
const source = JSON.stringify({
options: options,
parentId: parent.id,
});
if (source === props.notesSource) { return; }
// For now, search refresh is handled by the search screen.
if (props.notesParentType === 'Search') { return; }
let notes = [];
if (props.notesParentType === 'Folder') {
notes = await Note_1.default.previews(props.selectedFolderId, options);
} else if (props.notesParentType === 'Tag') {
notes = await Tag_1.default.notes(props.selectedTagId, options);
} else if (props.notesParentType === 'SmartFilter') {
notes = await Note_1.default.previews(null, options);
}
this.props.dispatch({
type: 'NOTE_UPDATE_ALL',
notes: notes,
notesSource: source,
});
}
parentItem(props = null) {
if (!props) { props = this.props; }
let output = null;
if (props.notesParentType === 'Folder') {
output = Folder_1.default.byId(props.folders, props.selectedFolderId);
} else if (props.notesParentType === 'Tag') {
output = Tag_1.default.byId(props.tags, props.selectedTagId);
} else if (props.notesParentType === 'SmartFilter') {
output = { id: this.props.selectedSmartFilterId, title: (0, locale_1._)('All notes') };
} else {
return null;
// throw new Error('Invalid parent type: ' + props.notesParentType);
}
return output;
}
folderPickerOptions() {
const options = {
visible: this.props.noteSelectionEnabled,
mustSelect: true,
};
if (this.folderPickerOptions_ && options.visible === this.folderPickerOptions_.visible) { return this.folderPickerOptions_; }
this.folderPickerOptions_ = options;
return this.folderPickerOptions_;
}
render() {
const parent = this.parentItem();
const theme = (0, global_style_1.themeStyle)(this.props.themeId);
const rootStyle = this.props.visible ? theme.rootStyle : theme.hiddenRootStyle;
const title = parent ? parent.title : null;
if (!parent) {
return (React.createElement(react_native_1.View, { style: rootStyle },
React.createElement(ScreenHeader_1.ScreenHeader, { title: title, showSideMenuButton: true, showBackButton: false })));
}
const icon = Folder_1.default.unserializeIcon(parent.icon);
const iconString = icon ? `${icon.emoji} ` : '';
let buttonFolderId = this.props.selectedFolderId !== Folder_1.default.conflictFolderId() ? this.props.selectedFolderId : null;
if (!buttonFolderId) { buttonFolderId = this.props.activeFolderId; }
const addFolderNoteButtons = !!buttonFolderId;
const makeActionButtonComp = () => {
if ((this.props.notesParentType === 'Folder' && (0, trash_1.itemIsInTrash)(parent)) || !Folder_1.default.atLeastOneRealFolderExists(this.props.folders)) { return null; }
if (addFolderNoteButtons && this.props.folders.length > 0) {
const buttons = [];
buttons.push({
label: (0, locale_1._)('New to-do'),
onPress: async () => {
const isTodo = true;
void this.newNoteNavigate(buttonFolderId, isTodo);
},
color: '#9b59b6',
icon: 'checkbox-outline',
});
buttons.push({
label: (0, locale_1._)('New note'),
onPress: async () => {
const isTodo = false;
void this.newNoteNavigate(buttonFolderId, isTodo);
},
color: '#9b59b6',
icon: 'document',
});
return React.createElement(FloatingActionButton_1.default, { buttons: buttons, dispatch: this.props.dispatch });
}
return null;
};
const actionButtonComp = this.props.noteSelectionEnabled || !this.props.visible ? null : makeActionButtonComp();
// Ensure that screen readers can't focus the notes list when it isn't visible.
const accessibilityHidden = !this.props.visible;
return (React.createElement(AccessibleView_1.default, { style: rootStyle, inert: accessibilityHidden },
React.createElement(ScreenHeader_1.ScreenHeader, { title: iconString + title, showBackButton: false, sortButton_press: this.sortButton_press, folderPickerOptions: this.folderPickerOptions(), showSearchButton: true, showSideMenuButton: true }),
React.createElement(NoteList_1.default, null),
actionButtonComp));
}
}
const NotesScreenWrapper = props => {
const dialogManager = (0, react_1.useContext)(DialogManager_1.DialogContext);
return React.createElement(NotesScreenComponent, { ...props, dialogManager: dialogManager });
};
const NotesScreen = (0, react_redux_1.connect)((state) => {
return {
folders: state.folders,
tags: state.tags,
activeFolderId: state.settings.activeFolderId,
selectedFolderId: state.selectedFolderId,
selectedNoteIds: state.selectedNoteIds,
selectedTagId: state.selectedTagId,
selectedSmartFilterId: state.selectedSmartFilterId,
notesParentType: state.notesParentType,
notes: state.notes,
notesSource: state.notesSource,
uncompletedTodosOnTop: state.settings.uncompletedTodosOnTop,
showCompletedTodos: state.settings.showCompletedTodos,
themeId: state.settings.theme,
noteSelectionEnabled: state.noteSelectionEnabled,
notesOrder: reducer_1.stateUtils.notesOrder(state.settings),
};
})(NotesScreenWrapper);
exports.default = NotesScreen;
// # sourceMappingURL=Notes.js.map

View File

@ -72,7 +72,12 @@ const jumpToHash = (view: EditorView, hash: string) => {
if (targetLocation !== undefined) {
view.dispatch({
selection: EditorSelection.cursor(targetLocation),
scrollIntoView: true,
effects: [
// Scrolls the target header/anchor to the top of the editor --
// users are usually interested in the content just below a header
// when clicking on a header link.
EditorView.scrollIntoView(targetLocation, { y: 'start' }),
],
});
return true;
}

View File

@ -142,6 +142,7 @@
"android-v3.3.4": true,
"v3.3.4": true,
"android-v3.3.5": true,
"ios-v13.3.3": true
"ios-v13.3.3": true,
"v3.3.5": true
}
}

View File

@ -1,5 +1,28 @@
# Joplin Desktop Changelog
## [v3.3.5](https://github.com/laurent22/joplin/releases/tag/v3.3.5) (Pre-release) - 2025-04-17T13:40:31Z
- New: Linux: Add more input-method-related start flags ([#12115](https://github.com/laurent22/joplin/issues/12115) by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator))
- New: Rich Text Editor: Add KaTeX to supported auto-replacements ([#12081](https://github.com/laurent22/joplin/issues/12081) by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator))
- Improved: Add a new menu item to launch the primary instance from the secondary one ([#12006](https://github.com/laurent22/joplin/issues/12006))
- Improved: By default keep 7 days of backup ([#12095](https://github.com/laurent22/joplin/issues/12095))
- Improved: Default plugins: Update Freehand Drawing to v3.0.0 ([#12103](https://github.com/laurent22/joplin/issues/12103) by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator))
- Improved: Default plugins: Update Freehand Drawing to v3.0.1 ([#12112](https://github.com/laurent22/joplin/issues/12112) by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator))
- Improved: Fix pasting images in the Rich Text Editor ([#12079](https://github.com/laurent22/joplin/issues/12079)) ([#12058](https://github.com/laurent22/joplin/issues/12058) by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator))
- Improved: Plugins: Expose hash from clicked cross-note link ([#12094](https://github.com/laurent22/joplin/issues/12094) by [@executed](https://github.com/executed))
- Improved: Plugins: Prevent plugin dialogs, panels, and editors from accessing the main JavaScript context ([#12083](https://github.com/laurent22/joplin/issues/12083) by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator))
- Improved: Print name of file when import fails ([c3fe0ed](https://github.com/laurent22/joplin/commit/c3fe0ed))
- Improved: Remove outline from list of plugins that are broken in the new editor ([#12107](https://github.com/laurent22/joplin/issues/12107) by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator))
- Improved: Rich Text Editor: Disallow inline event handlers ([#12106](https://github.com/laurent22/joplin/issues/12106) by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator))
- Improved: Update Freehand Drawing to v2.16.1 ([#12073](https://github.com/laurent22/joplin/issues/12073) by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator))
- Fixed: Fix Rich Text Editor deletes paragraphs when pressing enter after a resized image ([#12090](https://github.com/laurent22/joplin/issues/12090)) ([#12059](https://github.com/laurent22/joplin/issues/12059) by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator))
- Fixed: Fix returning form data from plugin dialogs ([#12092](https://github.com/laurent22/joplin/issues/12092) by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator))
- Fixed: Fix toggling lists in the Rich Text Editor ([#12071](https://github.com/laurent22/joplin/issues/12071)) ([#12042](https://github.com/laurent22/joplin/issues/12042) by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator))
- Fixed: Link to header: Move the Markdown editor cursor to the location of the link target ([#12118](https://github.com/laurent22/joplin/issues/12118)) ([#12105](https://github.com/laurent22/joplin/issues/12105) by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator))
- Fixed: Markdown Editor: Fix numbered sublist renumbering ([#12091](https://github.com/laurent22/joplin/issues/12091) by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator))
- Fixed: Rich Text Editor: Fix editor content not updated in some cases when switching notes ([#12084](https://github.com/laurent22/joplin/issues/12084) by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator))
- Fixed: Rich Text Editor: Fix keyboard and plugin-opened context menus sometimes not displayed or have incorrect content ([#12076](https://github.com/laurent22/joplin/issues/12076)) ([#9588](https://github.com/laurent22/joplin/issues/9588) by [@personalizedrefrigerator](https://github.com/personalizedrefrigerator))
## [v3.3.4](https://github.com/laurent22/joplin/releases/tag/v3.3.4) (Pre-release) - 2025-04-07T20:23:35Z
- New: Plugins: Add `setting.globalValues` and deprecate `setting.globalValue` ([ef51386](https://github.com/laurent22/joplin/commit/ef51386))

View File

@ -1,5 +1,7 @@
# Localisation
## Translating the applications
Joplin is currently available in the languages below. If you would like to contribute a **new translation**, it is quite straightforward, please follow these steps:
- [Download Poedit](https://poedit.net/), the translation editor, and install it.
@ -12,7 +14,13 @@ This translation will apply to the three applications - desktop, mobile and term
To **update a translation**, follow the same steps as above but instead of getting the .pot file, get the .po file for your language from the table below.
Current translations:
## Translating the documentation
The Joplin documentation translations are managed from [our project on Crowdin](https://crowdin.com/project/joplin-website). To participate simple create a Crowdin account and start translating.
If you would like to add a new language or for any other issue, please contact us [on the forum](https://discourse.joplinapp.org/) or GitHub.
## Current translations
<!-- LOCALE-TABLE-AUTO-GENERATED -->
&nbsp; | Language | Po File | Last translator | Percent done