Convert require to import: pad_editor, pad_modals, pad_userlist

- Convert const X = require('Y') to import X from 'Y.js'
- Convert const {A, B} = require('Y') to import {A, B} from 'Y.js'
- Add .js extensions to relative imports
- Keep external packages without .js (e.g., 'tinycon/tinycon')
- Convert exports.X = Y to export {X}
- Refactor forward references to allow function reordering

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
SamTV12345 2026-04-26 14:29:40 +02:00
parent 99774ee460
commit fea9e5128f
3 changed files with 15 additions and 15 deletions

View file

@ -22,10 +22,10 @@
* limitations under the License.
*/
import padutils from "./pad_utils";
const Ace2Editor = require('./ace').Ace2Editor;
import html10n from '../js/vendors/html10n'
const skinVariants = require('./skin_variants');
import padutils from "./pad_utils.js";
import {Ace2Editor} from './ace.js';
import html10n from '../js/vendors/html10n.js'
import skinVariants from './skin_variants.js';
const padeditor = (() => {
let pad = undefined;
@ -47,7 +47,7 @@ const padeditor = (() => {
const targetLineNumber = $(this).index() + 1;
window.location.hash = `L${targetLineNumber}`;
});
exports.focusOnLine(self.ace);
focusOnLine(self.ace);
self.ace.setProperty('wraps', true);
self.initViewOptions();
self.setViewOptions(initialViewOptions);
@ -248,9 +248,7 @@ const padeditor = (() => {
return self;
})();
exports.padeditor = padeditor;
exports.focusOnLine = (ace) => {
const focusOnLine = (ace) => {
// If a number is in the URI IE #L124 go to that line number
const lineNumber = window.location.hash.substr(1);
if (lineNumber) {
@ -296,3 +294,5 @@ exports.focusOnLine = (ace) => {
}
// End of setSelection / set Y position of editor
};
export {padeditor, focusOnLine};

View file

@ -23,8 +23,8 @@
* limitations under the License.
*/
const padeditbar = require('./pad_editbar').padeditbar;
const automaticReconnect = require('./pad_automatic_reconnect');
import {padeditbar} from './pad_editbar.js';
import automaticReconnect from './pad_automatic_reconnect.js';
const padmodals = (() => {
let pad = undefined;
@ -53,4 +53,4 @@ const padmodals = (() => {
return self;
})();
exports.padmodals = padmodals;
export {padmodals};

View file

@ -17,9 +17,9 @@
* limitations under the License.
*/
import padutils from './pad_utils'
const hooks = require('./pluginfw/hooks');
import html10n from './vendors/html10n';
import padutils from './pad_utils.js'
import hooks from './pluginfw/hooks.js';
import html10n from './vendors/html10n.js';
let myUserInfo = {};
let colorPickerOpen = false;
@ -619,4 +619,4 @@ const showColorPicker = () => {
}
};
exports.paduserlist = paduserlist;
export {paduserlist};