Pad: Move padLoad hook to Pad.init()

This commit is contained in:
Richard Hansen 2022-04-08 15:26:11 -04:00
parent f9610452cf
commit b38d66b30b
3 changed files with 2 additions and 2 deletions

View file

@ -395,6 +395,7 @@ Pad.prototype.init = async function (text, authorId = '') {
const firstChangeset = Changeset.makeSplice('\n', 0, 0, text);
await this.appendRevision(firstChangeset, authorId);
}
hooks.callAll('padLoad', {pad: this});
};
Pad.prototype.copy = async function (destinationID, force) {

View file

@ -22,7 +22,6 @@
const CustomError = require('../utils/customError');
const Pad = require('../db/Pad');
const db = require('./DB');
const hooks = require('../../static/js/pluginfw/hooks');
/**
* A cache of all loaded Pads.
@ -126,7 +125,6 @@ exports.getPad = async (id, text, authorId = '') => {
// initialize the pad
await pad.init(text, authorId);
hooks.callAll('padLoad', {pad});
globalPads.set(id, pad);
padList.addPad(id);