mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-24 09:26:14 -04:00
Feat/bundle js (#6511)
* Added minify * Added POC for browser * Moved first js files to ts * Fixed caret positioning * Added support for plugins * Fixed get undefined. * Removed require of socketio, l10n, html10n and error reporter * Added minify * Added POC for browser * Moved first js files to ts * Fixed caret positioning * Added support for plugins * Fixed get undefined. * Removed require of socketio, l10n, html10n and error reporter * Fixed popup not showing * Fixed timeslider * Reworked paths * Fixed loading * Don't generate sources map in production mode * Non working hmr * Added live reloading. * Fixed timeslider when hot reloading * Removed eval * Fixed. * Fixed env * Fixed frontend tests. * Added minifying via lightningcss * Added minify via esbuild * Fixed diagnostic url * Removed lightningcss * Fixed types * Fixed alias * Fixed loadtest * Fixed * Fixed loading ep_font_color3 * Restructure windows build * Fixed windows build * Fixed pnpm lock --------- Co-authored-by: SamTv12345 <samtv12345@samtv12345.com>
This commit is contained in:
parent
33b388b14c
commit
d6d636955c
53 changed files with 2764 additions and 1763 deletions
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* The Toolbar Module creates and renders the toolbars and buttons
|
||||
*/
|
||||
const _ = require('underscore');
|
||||
import {isString, reduce, each, isUndefined, map, first, last, extend, escape} from 'underscore';
|
||||
|
||||
const removeItem = (array: string[], what: string) => {
|
||||
let ax;
|
||||
|
@ -21,7 +21,7 @@ const defaultButtonAttributes = (name: string, overrides?: boolean) => ({
|
|||
const tag = (name: string, attributes: AttributeObj, contents?: string) => {
|
||||
const aStr = tagAttributes(attributes);
|
||||
|
||||
if (_.isString(contents) && contents!.length > 0) {
|
||||
if (isString(contents) && contents!.length > 0) {
|
||||
return `<${name}${aStr}>${contents}</${name}>`;
|
||||
} else {
|
||||
return `<${name}${aStr}></${name}>`;
|
||||
|
@ -34,14 +34,14 @@ type AttributeObj = {
|
|||
}
|
||||
|
||||
const tagAttributes = (attributes: AttributeObj) => {
|
||||
attributes = _.reduce(attributes || {}, (o: AttributeObj, val: string, name: string) => {
|
||||
if (!_.isUndefined(val)) {
|
||||
attributes = reduce(attributes || {}, (o: AttributeObj, val: string, name: string) => {
|
||||
if (!isUndefined(val)) {
|
||||
o[name] = val;
|
||||
}
|
||||
return o;
|
||||
}, {});
|
||||
|
||||
return ` ${_.map(attributes, (val: string, name: string) => `${name}="${_.escape(val)}"`).join(' ')}`;
|
||||
return ` ${map(attributes, (val: string, name: string) => `${name}="${escape(val)}"`).join(' ')}`;
|
||||
};
|
||||
|
||||
type ButtonGroupType = {
|
||||
|
@ -58,7 +58,7 @@ class ButtonGroup {
|
|||
|
||||
public static fromArray = function (array: string[]) {
|
||||
const btnGroup = new ButtonGroup();
|
||||
_.each(array, (btnName: string) => {
|
||||
each(array, (btnName: string) => {
|
||||
const button = Button.load(btnName) as Button
|
||||
btnGroup.addButton(button);
|
||||
});
|
||||
|
@ -70,18 +70,19 @@ class ButtonGroup {
|
|||
return this;
|
||||
}
|
||||
|
||||
render() {
|
||||
render(): string {
|
||||
if (this.buttons && this.buttons.length === 1) {
|
||||
this.buttons[0].grouping = '';
|
||||
} else if (this.buttons && this.buttons.length > 1) {
|
||||
_.first(this.buttons).grouping = 'grouped-left';
|
||||
_.last(this.buttons).grouping = 'grouped-right';
|
||||
_.each(this.buttons.slice(1, -1), (btn: Button) => {
|
||||
first(this.buttons)!.grouping = 'grouped-left';
|
||||
last(this.buttons)!.grouping = 'grouped-right';
|
||||
each(this.buttons.slice(1, -1), (btn: Button) => {
|
||||
btn.grouping = 'grouped-middle';
|
||||
});
|
||||
}
|
||||
|
||||
return _.map(this.buttons, (btn: ButtonGroup) => {
|
||||
// @ts-ignore
|
||||
return map(this.buttons, (btn: ButtonGroup) => {
|
||||
if (btn) return btn.render();
|
||||
}).join('\n');
|
||||
}
|
||||
|
@ -151,8 +152,8 @@ class SelectButton extends Button {
|
|||
select(attributes: AttributeObj) {
|
||||
const options: string[] = [];
|
||||
|
||||
_.each(this.options, (opt: AttributeSelect) => {
|
||||
const a = _.extend({
|
||||
each(this.options, (opt: AttributeSelect) => {
|
||||
const a = extend({
|
||||
value: opt.value,
|
||||
}, opt.attributes);
|
||||
|
||||
|
@ -299,7 +300,7 @@ module.exports = {
|
|||
buttons[0].push('savedrevision');
|
||||
}
|
||||
|
||||
const groups = _.map(buttons, (group: string[]) => ButtonGroup.fromArray(group).render());
|
||||
const groups = map(buttons, (group: string[]) => ButtonGroup.fromArray(group).render());
|
||||
return groups.join(this.separator());
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue