mirror of https://github.com/laurent22/joplin.git
Mobile: Support description banners on plugin-registered settings screens (#10286)
parent
ff86c253d3
commit
b638056150
|
@ -575,6 +575,7 @@ packages/app-mobile/components/screens/ConfigScreen/NoteExportSection/utils/expo
|
|||
packages/app-mobile/components/screens/ConfigScreen/NoteExportSection/utils/exportDebugReport.js
|
||||
packages/app-mobile/components/screens/ConfigScreen/NoteExportSection/utils/exportProfile.js
|
||||
packages/app-mobile/components/screens/ConfigScreen/NoteExportSection/utils/makeImportExportCacheDirectory.js
|
||||
packages/app-mobile/components/screens/ConfigScreen/SectionDescription.js
|
||||
packages/app-mobile/components/screens/ConfigScreen/SectionHeader.js
|
||||
packages/app-mobile/components/screens/ConfigScreen/SectionSelector.js
|
||||
packages/app-mobile/components/screens/ConfigScreen/SettingComponent.js
|
||||
|
|
|
@ -555,6 +555,7 @@ packages/app-mobile/components/screens/ConfigScreen/NoteExportSection/utils/expo
|
|||
packages/app-mobile/components/screens/ConfigScreen/NoteExportSection/utils/exportDebugReport.js
|
||||
packages/app-mobile/components/screens/ConfigScreen/NoteExportSection/utils/exportProfile.js
|
||||
packages/app-mobile/components/screens/ConfigScreen/NoteExportSection/utils/makeImportExportCacheDirectory.js
|
||||
packages/app-mobile/components/screens/ConfigScreen/SectionDescription.js
|
||||
packages/app-mobile/components/screens/ConfigScreen/SectionHeader.js
|
||||
packages/app-mobile/components/screens/ConfigScreen/SectionSelector.js
|
||||
packages/app-mobile/components/screens/ConfigScreen/SettingComponent.js
|
||||
|
|
|
@ -149,7 +149,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
|
|||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
||||
public renderSectionDescription(section: any) {
|
||||
const description = Setting.sectionDescription(section.name);
|
||||
const description = Setting.sectionDescription(section.name, AppType.Desktop);
|
||||
if (!description) return null;
|
||||
|
||||
const theme = themeStyle(this.props.themeId);
|
||||
|
|
|
@ -32,6 +32,7 @@ import PluginService, { PluginSettings } from '@joplin/lib/services/plugins/Plug
|
|||
import PluginStates, { getSearchText as getPluginStatesSearchText } from './plugins/PluginStates';
|
||||
import PluginUploadButton, { canInstallPluginsFromFile, buttonLabel as pluginUploadButtonSearchText } from './plugins/PluginUploadButton';
|
||||
import NoteImportButton, { importButtonDefaultTitle, importButtonDescription } from './NoteExportSection/NoteImportButton';
|
||||
import SectionDescription from './SectionDescription';
|
||||
|
||||
interface ConfigScreenState {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
||||
|
@ -354,6 +355,15 @@ class ConfigScreenComponent extends BaseScreenComponent<ConfigScreenProps, Confi
|
|||
const advancedSettingComps: ReactElement[] = [];
|
||||
|
||||
const headerTitle = Setting.sectionNameToLabel(section.name);
|
||||
const sectionDescription = Setting.sectionDescription(key, AppType.Mobile);
|
||||
if (sectionDescription && !this.state.searching) {
|
||||
settingComps.push(
|
||||
<SectionDescription
|
||||
key='section-description'
|
||||
content={sectionDescription}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
|
||||
const matchesSearchQuery = (relatedText: string|string[]) => {
|
||||
let searchThrough;
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
import * as React from 'react';
|
||||
import { ViewStyle } from 'react-native';
|
||||
import { Banner } from 'react-native-paper';
|
||||
|
||||
interface Props {
|
||||
content: string;
|
||||
}
|
||||
|
||||
const style: ViewStyle = { marginBottom: 10 };
|
||||
|
||||
const SectionDescription: React.FC<Props> = props => {
|
||||
return (
|
||||
<Banner
|
||||
visible={true}
|
||||
icon='information'
|
||||
style={style}
|
||||
>
|
||||
{props.content}
|
||||
</Banner>
|
||||
);
|
||||
};
|
||||
export default SectionDescription;
|
|
@ -2784,9 +2784,13 @@ class Setting extends BaseModel {
|
|||
return name;
|
||||
}
|
||||
|
||||
public static sectionDescription(name: string) {
|
||||
if (name === 'markdownPlugins') return _('These plugins enhance the Markdown renderer with additional features. Please note that, while these features might be useful, they are not standard Markdown and thus most of them will only work in Joplin. Additionally, some of them are *incompatible* with the WYSIWYG editor. If you open a note that uses one of these plugins in that editor, you will lose the plugin formatting. It is indicated below which plugins are compatible or not with the WYSIWYG editor.');
|
||||
if (name === 'general') return _('Notes and settings are stored in: %s', toSystemSlashes(this.value('profileDir'), process.platform));
|
||||
public static sectionDescription(name: string, appType: AppType) {
|
||||
if (name === 'markdownPlugins' && appType === AppType.Desktop) {
|
||||
return _('These plugins enhance the Markdown renderer with additional features. Please note that, while these features might be useful, they are not standard Markdown and thus most of them will only work in Joplin. Additionally, some of them are *incompatible* with the WYSIWYG editor. If you open a note that uses one of these plugins in that editor, you will lose the plugin formatting. It is indicated below which plugins are compatible or not with the WYSIWYG editor.');
|
||||
}
|
||||
if (name === 'general' && appType === AppType.Desktop) {
|
||||
return _('Notes and settings are stored in: %s', toSystemSlashes(this.value('profileDir'), process.platform));
|
||||
}
|
||||
|
||||
if (this.customSections_[name] && this.customSections_[name].description) return this.customSections_[name].description;
|
||||
|
||||
|
|
Loading…
Reference in New Issue