1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-27 23:28:38 +02:00

Desktop: Turn old plugin deprecation notices into errors

This commit is contained in:
Laurent Cozic
2021-08-05 12:02:03 +01:00
parent 8471be16aa
commit 7f00e4ea5b
9 changed files with 32 additions and 14 deletions

View File

@ -54,7 +54,7 @@ export default class JoplinPlugins {
* @deprecated Use joplin.contentScripts.register()
*/
public async registerContentScript(type: ContentScriptType, id: string, scriptPath: string) {
this.plugin.deprecationNotice('1.8', 'joplin.plugins.registerContentScript() is deprecated in favour of joplin.contentScripts.register()');
this.plugin.deprecationNotice('1.8', 'joplin.plugins.registerContentScript() is deprecated in favour of joplin.contentScripts.register()', true);
return this.plugin.registerContentScript(type, id, scriptPath);
}

View File

@ -77,7 +77,7 @@ export default class JoplinSettings {
* Registers a new setting.
*/
public async registerSetting(key: string, settingItem: SettingItem) {
this.plugin_.deprecationNotice('1.8', 'joplin.settings.registerSetting() is deprecated in favour of joplin.settings.registerSettings()');
this.plugin_.deprecationNotice('1.8', 'joplin.settings.registerSetting() is deprecated in favour of joplin.settings.registerSettings()', true);
await this.registerSettings({ [key]: settingItem });
}

View File

@ -53,7 +53,7 @@ export default class JoplinViewsDialogs {
*/
async create(id: string): Promise<ViewHandle> {
if (!id) {
this.plugin.deprecationNotice('1.5', 'Creating a view without an ID is deprecated. To fix it, change your call to `joplin.views.dialogs.create("my-unique-id")`');
this.plugin.deprecationNotice('1.5', 'Creating a view without an ID is deprecated. To fix it, change your call to `joplin.views.dialogs.create("my-unique-id")`', true);
id = `${this.plugin.viewCount}`;
}

View File

@ -24,7 +24,7 @@ export default class JoplinViewsMenuItems {
*/
public async create(id: string, commandName: string, location: MenuItemLocation = MenuItemLocation.Tools, options: CreateMenuItemOptions = null) {
if (typeof location !== 'string') {
this.plugin.deprecationNotice('1.5', 'Creating a view without an ID is deprecated. To fix it, change your call to `joplin.views.menuItem.create("my-unique-id", ...)`');
this.plugin.deprecationNotice('1.5', 'Creating a view without an ID is deprecated. To fix it, change your call to `joplin.views.menuItem.create("my-unique-id", ...)`', true);
options = location as any;
location = commandName as any || MenuItemLocation.Tools;
commandName = id as any;

View File

@ -37,7 +37,7 @@ export default class JoplinViewsMenus {
*/
public async create(id: string, label: string, menuItems: MenuItem[], location: MenuItemLocation = MenuItemLocation.Tools) {
if (!Array.isArray(menuItems)) {
this.plugin.deprecationNotice('1.5', 'Creating a view without an ID is deprecated. To fix it, change your call to `joplin.views.menus.create("my-unique-id", ...)`');
this.plugin.deprecationNotice('1.5', 'Creating a view without an ID is deprecated. To fix it, change your call to `joplin.views.menus.create("my-unique-id", ...)`', true);
location = menuItems as any || MenuItemLocation.Tools;
menuItems = label as any;
label = id as any;

View File

@ -31,7 +31,7 @@ export default class JoplinViewsPanels {
*/
public async create(id: string): Promise<ViewHandle> {
if (!id) {
this.plugin.deprecationNotice('1.5', 'Creating a view without an ID is deprecated. To fix it, change your call to `joplin.views.panels.create("my-unique-id")`');
this.plugin.deprecationNotice('1.5', 'Creating a view without an ID is deprecated. To fix it, change your call to `joplin.views.panels.create("my-unique-id")`', true);
id = `${this.plugin.viewCount}`;
}

View File

@ -23,7 +23,7 @@ export default class JoplinViewsToolbarButtons {
*/
async create(id: string, commandName: string, location: ToolbarButtonLocation) {
if (arguments.length < 3) {
this.plugin.deprecationNotice('1.5', 'Creating a view without an ID is deprecated. To fix it, change your call to `joplin.views.toolbarButtons.create("my-unique-id", ...)`');
this.plugin.deprecationNotice('1.5', 'Creating a view without an ID is deprecated. To fix it, change your call to `joplin.views.toolbarButtons.create("my-unique-id", ...)`', true);
location = commandName as any;
commandName = id as any;
id = `${this.plugin.viewCount}`;