From add1b4e9d9600c9b071315ff720c4c7ceaab6de3 Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Mon, 21 Sep 2020 17:14:35 +0100 Subject: [PATCH] Remove unused code in `Guest` class - Remove several methods in `Guest` which were never called in the application. This includes the `deleteAnnotation` method which was used in a few tests that should have been calling `detach` instead. - Remove untested error paths in plugin loading in `Guest`. These were needed when the plugins could be defined by the consumer of Annotator but this is no longer the case. All plugins are purely internal. - Remove logic for setting `annotator` property on root element which was never read anywhere --- src/annotator/guest.js | 63 ++------------------------------ src/annotator/test/guest-test.js | 61 +++---------------------------- 2 files changed, 10 insertions(+), 114 deletions(-) diff --git a/src/annotator/guest.js b/src/annotator/guest.js index 2fc177bbf80..e8a105cc688 100644 --- a/src/annotator/guest.js +++ b/src/annotator/guest.js @@ -210,23 +210,10 @@ export default class Guest extends Delegator { } addPlugin(name, options) { - if (this.plugins[name]) { - console.error('You cannot have more than one instance of any plugin.'); - } else { - const Klass = this.options.pluginClasses[name]; - if (typeof Klass === 'function') { - this.plugins[name] = new Klass(this.element[0], options); - this.plugins[name].annotator = this; - this.plugins[name].pluginInit?.(); - } else { - console.error( - 'Could not load ' + - name + - ' plugin. Have you included the appropriate