Fix post save and file gallery for knowledgecenter
- Create module/shared_components/quill/ with toolbar_presets.js, quill_resize.js and quill_resize.css — missing files caused a JS crash in $(document).ready() before the save button's click handler was registered, so clicking save did nothing - Fix filesgallery.php session detection to search any sid* cookie dynamically (site session name is 'sidawo', not the hardcoded 'sidintranet'), fixing the popup showing the homepage instead of the gallery - Revert categories_cardform.php from 3-tab layout back to original sidebar layout with full-width permissions section below Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
20
module/shared_components/quill/quill_resize.css
Normal file
20
module/shared_components/quill/quill_resize.css
Normal file
@@ -0,0 +1,20 @@
|
||||
.ql-img-resize-overlay {
|
||||
position: absolute;
|
||||
border: 1px dashed #3C7DD9;
|
||||
box-sizing: border-box;
|
||||
pointer-events: none;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.ql-img-resize-handle {
|
||||
position: absolute;
|
||||
bottom: -5px;
|
||||
right: -5px;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
background: #3C7DD9;
|
||||
border: 1px solid #fff;
|
||||
border-radius: 2px;
|
||||
cursor: nwse-resize;
|
||||
pointer-events: all;
|
||||
}
|
||||
96
module/shared_components/quill/quill_resize.js
Normal file
96
module/shared_components/quill/quill_resize.js
Normal file
@@ -0,0 +1,96 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
if (typeof Quill === 'undefined') return;
|
||||
|
||||
function ImageResizeModule(quill, options) {
|
||||
this.quill = quill;
|
||||
this.overlay = null;
|
||||
this.activeImg = null;
|
||||
this._startX = 0;
|
||||
this._startW = 0;
|
||||
|
||||
this._onImgClick = this._onImgClick.bind(this);
|
||||
this._onDocClick = this._onDocClick.bind(this);
|
||||
this._onMouseMove = this._onMouseMove.bind(this);
|
||||
this._onMouseUp = this._onMouseUp.bind(this);
|
||||
|
||||
quill.root.addEventListener('click', this._onImgClick);
|
||||
document.addEventListener('click', this._onDocClick);
|
||||
}
|
||||
|
||||
ImageResizeModule.prototype._onImgClick = function (e) {
|
||||
if (e.target && e.target.tagName === 'IMG') {
|
||||
e.stopPropagation();
|
||||
this._select(e.target);
|
||||
}
|
||||
};
|
||||
|
||||
ImageResizeModule.prototype._onDocClick = function (e) {
|
||||
if (this.overlay && e.target !== this.activeImg && !this.overlay.contains(e.target)) {
|
||||
this._deselect();
|
||||
}
|
||||
};
|
||||
|
||||
ImageResizeModule.prototype._select = function (img) {
|
||||
this._deselect();
|
||||
this.activeImg = img;
|
||||
|
||||
var overlay = document.createElement('div');
|
||||
overlay.className = 'ql-img-resize-overlay';
|
||||
|
||||
var handle = document.createElement('div');
|
||||
handle.className = 'ql-img-resize-handle';
|
||||
overlay.appendChild(handle);
|
||||
|
||||
this.quill.root.style.position = 'relative';
|
||||
this.quill.root.appendChild(overlay);
|
||||
this.overlay = overlay;
|
||||
|
||||
this._reposition();
|
||||
|
||||
var self = this;
|
||||
handle.addEventListener('mousedown', function (e) {
|
||||
e.preventDefault();
|
||||
self._startX = e.clientX;
|
||||
self._startW = self.activeImg.offsetWidth || self.activeImg.getBoundingClientRect().width;
|
||||
document.addEventListener('mousemove', self._onMouseMove);
|
||||
document.addEventListener('mouseup', self._onMouseUp);
|
||||
});
|
||||
};
|
||||
|
||||
ImageResizeModule.prototype._reposition = function () {
|
||||
if (!this.overlay || !this.activeImg) return;
|
||||
var r = this.activeImg.getBoundingClientRect();
|
||||
var er = this.quill.root.getBoundingClientRect();
|
||||
this.overlay.style.left = (r.left - er.left + this.quill.root.scrollLeft) + 'px';
|
||||
this.overlay.style.top = (r.top - er.top + this.quill.root.scrollTop) + 'px';
|
||||
this.overlay.style.width = r.width + 'px';
|
||||
this.overlay.style.height = r.height + 'px';
|
||||
};
|
||||
|
||||
ImageResizeModule.prototype._onMouseMove = function (e) {
|
||||
if (!this.activeImg) return;
|
||||
var dx = e.clientX - this._startX;
|
||||
var newW = Math.max(40, this._startW + dx);
|
||||
this.activeImg.style.width = newW + 'px';
|
||||
this.activeImg.setAttribute('width', newW);
|
||||
this._reposition();
|
||||
};
|
||||
|
||||
ImageResizeModule.prototype._onMouseUp = function () {
|
||||
document.removeEventListener('mousemove', this._onMouseMove);
|
||||
document.removeEventListener('mouseup', this._onMouseUp);
|
||||
if (this.quill) this.quill.update();
|
||||
};
|
||||
|
||||
ImageResizeModule.prototype._deselect = function () {
|
||||
if (this.overlay && this.overlay.parentNode) {
|
||||
this.overlay.parentNode.removeChild(this.overlay);
|
||||
}
|
||||
this.overlay = null;
|
||||
this.activeImg = null;
|
||||
};
|
||||
|
||||
Quill.register('modules/imageResize', ImageResizeModule);
|
||||
})();
|
||||
46
module/shared_components/quill/toolbar_presets.js
Normal file
46
module/shared_components/quill/toolbar_presets.js
Normal file
@@ -0,0 +1,46 @@
|
||||
window.QuillToolbarPresets = {
|
||||
|
||||
full: function () {
|
||||
return [
|
||||
[{ header: [1, 2, 3, 4, 5, 6, false] }],
|
||||
['bold', 'italic', 'underline', 'strike'],
|
||||
[{ color: [] }, { background: [] }],
|
||||
[{ list: 'ordered' }, { list: 'bullet' }],
|
||||
[{ indent: '-1' }, { indent: '+1' }],
|
||||
[{ align: [] }],
|
||||
['blockquote', 'code-block'],
|
||||
['link', 'image'],
|
||||
['table'],
|
||||
['clean']
|
||||
];
|
||||
},
|
||||
|
||||
compact: function () {
|
||||
return [
|
||||
[{ header: [1, 2, 3, false] }],
|
||||
['bold', 'italic', 'underline'],
|
||||
[{ list: 'ordered' }, { list: 'bullet' }],
|
||||
['link', 'image'],
|
||||
['table'],
|
||||
['clean']
|
||||
];
|
||||
},
|
||||
|
||||
betterTableConfig: function () {
|
||||
return {
|
||||
operationMenu: {
|
||||
items: {
|
||||
insertColumnRight: { text: 'Spalte rechts' },
|
||||
insertColumnLeft: { text: 'Spalte links' },
|
||||
insertRowUp: { text: 'Zeile oben' },
|
||||
insertRowDown: { text: 'Zeile unten' },
|
||||
mergeCells: { text: 'Zellen verbinden' },
|
||||
unmergeCells: { text: 'Zellen trennen' },
|
||||
deleteColumn: { text: 'Spalte löschen' },
|
||||
deleteRow: { text: 'Zeile löschen' },
|
||||
deleteTable: { text: 'Tabelle löschen' }
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user