mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-11 18:00:26 +00:00
Fix: allow overwrite plugin that don't have plugin-priority (#8800)
* fix: allow overwrite plugin that don't have plugin-priority * Update boot.js * Update boot.js
This commit is contained in:
parent
42b2b9fd20
commit
673a0f5605
18
boot/boot.js
18
boot/boot.js
@ -1470,17 +1470,15 @@ $tw.Wiki = function(options) {
|
|||||||
// Unpack the currently registered plugins, creating shadow tiddlers for their constituent tiddlers
|
// Unpack the currently registered plugins, creating shadow tiddlers for their constituent tiddlers
|
||||||
this.unpackPluginTiddlers = function() {
|
this.unpackPluginTiddlers = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
// Sort the plugin titles by the `plugin-priority` field
|
// Sort the plugin titles by the `plugin-priority` field, if this field is missing, default to 1
|
||||||
pluginTiddlers.sort(function(a,b) {
|
pluginTiddlers.sort(function(a, b) {
|
||||||
if("plugin-priority" in a.fields && "plugin-priority" in b.fields) {
|
var priorityA = "plugin-priority" in a.fields ? a.fields["plugin-priority"] : 1;
|
||||||
return a.fields["plugin-priority"] - b.fields["plugin-priority"];
|
var priorityB = "plugin-priority" in b.fields ? b.fields["plugin-priority"] : 1;
|
||||||
} else if("plugin-priority" in a.fields) {
|
if (priorityA !== priorityB) {
|
||||||
|
return priorityA - priorityB;
|
||||||
|
} else if (a.fields.title < b.fields.title) {
|
||||||
return -1;
|
return -1;
|
||||||
} else if("plugin-priority" in b.fields) {
|
} else if (a.fields.title === b.fields.title) {
|
||||||
return +1;
|
|
||||||
} else if(a.fields.title < b.fields.title) {
|
|
||||||
return -1;
|
|
||||||
} else if(a.fields.title === b.fields.title) {
|
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return +1;
|
return +1;
|
||||||
|
Loading…
Reference in New Issue
Block a user