Skip to content

Commit

Permalink
relocate options of plugin (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
hizzgdev authored May 30, 2023
1 parent 176d257 commit 9c30ab8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
12 changes: 9 additions & 3 deletions example/2_features.html
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,15 @@
<input class="file" type="file" id="image-chooser" accept="image/*" />
</div>
</div>
<script type="text/javascript" src="/es6/jsmind.js"></script>
<script type="text/javascript" src="/es6/jsmind.draggable-node.js"></script>
<script type="text/javascript" src="/es6/jsmind.screenshot.js"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/npm/jsmind/es6/jsmind.js"></script>
<script
type="text/javascript"
src="//cdn.jsdelivr.net/npm/jsmind/es6/jsmind.draggable-node.js"
></script>
<script
type="text/javascript"
src="//cdn.jsdelivr.net/npm/jsmind/es6/jsmind.screenshot.js"
></script>
<script type="text/javascript" src="2_features.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion src/jsmind.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default class jsMind {

this._event_bind();

apply_plugins(this, this.options);
apply_plugins(this, this.options.plugin);
}
get_editable() {
return this.options.editable;
Expand Down
1 change: 1 addition & 0 deletions src/jsmind.option.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const default_options = {
down: 40, // Down
},
},
plugin: {},
};

export function merge_option(options) {
Expand Down
6 changes: 5 additions & 1 deletion src/plugins/jsmind.draggable-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ const DEFAULT_OPTIONS = {

class DraggableNode {
constructor(jm, options) {
var opts = {};
jsMind.util.json.merge(opts, DEFAULT_OPTIONS);
jsMind.util.json.merge(opts, options);

this.jm = jm;
this.options = jsMind.util.json.merge(options || {}, DEFAULT_OPTIONS);
this.options = opts;
this.e_canvas = null;
this.canvas_ctx = null;
this.shadow = null;
Expand Down

0 comments on commit 9c30ab8

Please sign in to comment.