Fixed custom font issue
This commit is contained in:
@ -6,14 +6,12 @@ colors:
|
|||||||
primary_dark: '#005384'
|
primary_dark: '#005384'
|
||||||
secondary: '#00B0F0'
|
secondary: '#00B0F0'
|
||||||
text_dark: '#616161'
|
text_dark: '#616161'
|
||||||
|
|
||||||
favicon:
|
favicon:
|
||||||
path: favicon.png
|
path: favicon.png
|
||||||
|
|
||||||
fonts:
|
fonts:
|
||||||
primary:
|
primary:
|
||||||
name: trixie.woff
|
name: trixie
|
||||||
fallback: sans-serif
|
fallback: sans-serif
|
||||||
secondary:
|
secondary:
|
||||||
name: trixie.woff
|
name: trixie
|
||||||
fallback: serif
|
fallback: serif
|
||||||
|
@ -415,7 +415,8 @@ def upload_font():
|
|||||||
fonts_dir = Path(__file__).resolve().parents[3] / "config" / "themes" / theme_name / "fonts"
|
fonts_dir = Path(__file__).resolve().parents[3] / "config" / "themes" / theme_name / "fonts"
|
||||||
fonts_dir.mkdir(parents=True, exist_ok=True)
|
fonts_dir.mkdir(parents=True, exist_ok=True)
|
||||||
file.save(fonts_dir / file.filename)
|
file.save(fonts_dir / file.filename)
|
||||||
return jsonify({"status": "ok", "filename": file.filename})
|
font_basename = Path(file.filename).stem
|
||||||
|
return jsonify({"status": "ok", "filename": font_basename})
|
||||||
|
|
||||||
@app.route("/api/font/remove", methods=["POST"])
|
@app.route("/api/font/remove", methods=["POST"])
|
||||||
def remove_font():
|
def remove_font():
|
||||||
|
@ -70,9 +70,11 @@ function setupColorPicker(colorId, btnId, textId, initial) {
|
|||||||
function setFontDropdown(selectId, value, options) {
|
function setFontDropdown(selectId, value, options) {
|
||||||
const select = document.getElementById(selectId);
|
const select = document.getElementById(selectId);
|
||||||
if (!select) return;
|
if (!select) return;
|
||||||
select.innerHTML = options.map(opt =>
|
select.innerHTML = options.map(opt => {
|
||||||
`<option value="${opt}"${opt === value ? " selected" : ""}>${opt}</option>`
|
// Remove extension if present
|
||||||
).join("");
|
const base = opt.replace(/\.(woff2?|ttf|otf)$/, "");
|
||||||
|
return `<option value="${base}"${base === value ? " selected" : ""}>${base}</option>`;
|
||||||
|
}).join("");
|
||||||
}
|
}
|
||||||
|
|
||||||
function setFallbackDropdown(selectId, value) {
|
function setFallbackDropdown(selectId, value) {
|
||||||
|
Reference in New Issue
Block a user