1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-24 23:26:50 +02:00

Mobile: Fixed mobile build

This commit is contained in:
Laurent Cozic
2021-01-27 17:42:58 +00:00
parent 35597ce3c2
commit 12187b9da3
24 changed files with 1247 additions and 79 deletions

View File

@ -2,26 +2,24 @@ import markdownUtils from './markdownUtils';
import Setting from './models/Setting';
import shim from './shim';
import MarkupToHtml, { MarkupLanguage } from '@joplin/renderer/MarkupToHtml';
import { PluginStates } from './services/plugins/reducer';
import { contentScriptsToRendererRules } from './services/plugins/utils/loadContentScripts';
const htmlUtils = require('./htmlUtils');
import Resource from './models/Resource';
class MarkupLanguageUtils {
lib_(language: MarkupLanguage) {
export class MarkupLanguageUtils {
private lib_(language: MarkupLanguage) {
if (language === MarkupLanguage.Html) return htmlUtils;
if (language === MarkupLanguage.Markdown) return markdownUtils;
throw new Error(`Unsupported markup language: ${language}`);
}
extractImageUrls(language: MarkupLanguage, text: string) {
public extractImageUrls(language: MarkupLanguage, text: string) {
return this.lib_(language).extractImageUrls(text);
}
// Create a new MarkupToHtml instance while injecting options specific to Joplin
// desktop and mobile applications.
newMarkupToHtml(plugins: PluginStates, options: any = null) {
public newMarkupToHtml(options: any = null) {
const subValues = Setting.subValues('markdown.plugin', Setting.toPlainObject());
const pluginOptions: any = {};
for (const n in subValues) {
@ -33,7 +31,6 @@ class MarkupLanguageUtils {
pluginOptions: pluginOptions,
tempDir: Setting.value('tempDir'),
fsDriver: shim.fsDriver(),
extraRendererRules: contentScriptsToRendererRules(plugins),
}, options);
return new MarkupToHtml(options);