From: Radek Czajka Date: Wed, 3 Feb 2021 11:32:11 +0000 (+0100) Subject: More image properties. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/aee9f15afdae1c21e12b7ddc0671c0a619a7776f More image properties. --- diff --git a/src/redakcja/static/css/html.css b/src/redakcja/static/css/html.css index 5a969fb8..05c9e9ed 100644 --- a/src/redakcja/static/css/html.css +++ b/src/redakcja/static/css/html.css @@ -312,6 +312,10 @@ word-spacing: 1em; } +.htmlview .ilustr img { + max-width: 100%; +} + .htmlview .parse-warning { display: block; font-size: 10pt; diff --git a/src/redakcja/static/js/wiki/view_properties.js b/src/redakcja/static/js/wiki/view_properties.js index 571dac00..32a7101b 100644 --- a/src/redakcja/static/js/wiki/view_properties.js +++ b/src/redakcja/static/js/wiki/view_properties.js @@ -13,6 +13,19 @@ "name": "alt", "type": "text", }, + { + "name": "szer", + "type": "percent", + }, + { + "name": "wyrownanie", + "type": "select", + "options": ["lewo", "srodek", "prawo"], + }, + { + "name": "oblew", + "type": "bool", + }, ], }, "ref": { @@ -45,8 +58,15 @@ self.$pane.on('change', '.form-control', function() { let $input = $(this); + let inputval; + if ($input.attr('type') == 'checkbox') { + inputval = $input.is(':checked'); + } else { + inputval = $input.val(); + } + if ($input.data("edited")) { - $input.data("edited").text($input.val()); + $input.data("edited").text(inputval); return; } @@ -56,7 +76,8 @@ w(222) let $xmlelem = $($.parseXML(xml)); w(333, $xmlelem) - $xmlelem.contents().attr($input.data('property'), $input.val()); + w($input.data('property'), $input.val()); + $xmlelem.contents().attr($input.data('property'), inputval); w(444, $xmlelem) let newxml = (new XMLSerializer()).serializeToString($xmlelem[0]); w(555, newxml) @@ -104,7 +125,7 @@ let nodeDef = elementDefs[node]; if (nodeDef && nodeDef.attributes) { $.each(nodeDef.attributes, function(i, a) { - self.addEditField(a.name, a.type, $(element).attr('data-wlf-' + a.name)); // ... + self.addEditField(a, $(element).attr('data-wlf-' + a.name)); // ... }) } @@ -115,8 +136,7 @@ $("> .RDF > .Description > [x-node]", $node).each(function() { $meta = $(this); self.addEditField( - $meta.attr('x-node'), - null, + {"name": $meta.attr('x-node'),}, $meta.text(), $meta, ); @@ -124,20 +144,37 @@ } }; - PropertiesPerspective.prototype.addEditField = function(name, type, value, elem) { + PropertiesPerspective.prototype.addEditField = function(defn, value, elem) { let self = this; let $form = $("#properties-form", self.$pane); let $fg = $("
"); - $("