mirror of https://github.com/laurent22/joplin.git
Desktop: Disable userstyle.css when printing or exporting to PDF
parent
bc58668483
commit
2203a39917
|
@ -887,7 +887,10 @@ class NoteTextComponent extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
updateHtml(body = null) {
|
||||
updateHtml(body = null, options = null) {
|
||||
if (!options) options = {};
|
||||
if (!('useCustomCss' in options)) options.useCustomCss = true;
|
||||
|
||||
const mdOptions = {
|
||||
onResourceLoaded: () => {
|
||||
if (this.resourceLoadedTimeoutId_) {
|
||||
|
@ -917,7 +920,8 @@ class NoteTextComponent extends React.Component {
|
|||
bodyToRender = '*' + _('This note has no content. Click on "%s" to toggle the editor and edit the note.', _('Layout')) + '*';
|
||||
}
|
||||
|
||||
bodyToRender = '<style>' + this.props.customCss + '</style>\n' + bodyToRender;
|
||||
if (options.useCustomCss) bodyToRender = '<style>' + this.props.customCss + '</style>\n' + bodyToRender;
|
||||
|
||||
bodyHtml = this.mdToHtml().render(bodyToRender, theme, mdOptions);
|
||||
|
||||
this.setState({ bodyHtml: bodyHtml });
|
||||
|
@ -1065,7 +1069,7 @@ class NoteTextComponent extends React.Component {
|
|||
const previousTheme = Setting.value('theme');
|
||||
Setting.setValue('theme', Setting.THEME_LIGHT);
|
||||
this.lastSetHtml_ = '';
|
||||
this.updateHtml(tempBody);
|
||||
this.updateHtml(tempBody, { useCustomCss: false });
|
||||
this.forceUpdate();
|
||||
|
||||
const restoreSettings = () => {
|
||||
|
|
|
@ -289,7 +289,7 @@ It is generally recommended to enter the notes as Markdown as it makes the notes
|
|||
|
||||
## Custom CSS
|
||||
|
||||
Rendered markdown can be customized by placing a userstyle file in the profile directory `~/.config/joplin-desktop/userstyle.css` (This path might be different on your device - check at the top of the Config screen for the exact path). This file supports standard CSS syntax.
|
||||
Rendered markdown can be customized by placing a userstyle file in the profile directory `~/.config/joplin-desktop/userstyle.css` (This path might be different on your device - check at the top of the Config screen for the exact path). This file supports standard CSS syntax. Note that this file is used only when display the notes, **not when printing or exporting to PDF**. This is because printing has a lot more restrictions (for example, printing white text over a black background is usually not wanted), so special rules are applied to make it look good when printing, and a userstyle.css would interfer with that.
|
||||
|
||||
# Searching
|
||||
|
||||
|
|
Loading…
Reference in New Issue