X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/d86195c3b7dc2726a9eff10fdb2b9f5190ca15fe..fd9164545d4a1cf2d508b4125a45643a0b8375fa:/src/redakcja/static/js/wiki/view_editor_wysiwyg.js
diff --git a/src/redakcja/static/js/wiki/view_editor_wysiwyg.js b/src/redakcja/static/js/wiki/view_editor_wysiwyg.js
index 2e1c28d2..1c9f2ed3 100644
--- a/src/redakcja/static/js/wiki/view_editor_wysiwyg.js
+++ b/src/redakcja/static/js/wiki/view_editor_wysiwyg.js
@@ -110,7 +110,7 @@
success: function(text){
var t = $(text);
tag.replaceWith(t);
- openForEdit(t);
+ openForEdit(t, trim=false);
},
error: function(){
tag.remove();
@@ -405,7 +405,7 @@
}
/* open edition window for selected fragment */
- function openForEdit($origin){
+ function openForEdit($origin, trim=true){
var $box = null
// annotations overlay their sub box - not their own box //
@@ -441,7 +441,7 @@
}
// start edition on this node
- var $overlay = $('
Zapisz UsuÅ tytuÅ dzieÅa wyróżnienie sÅowo obce znak spec.
').css({
+ var $overlay = $('').css({
position: 'absolute',
height: h,
left: x,
@@ -515,7 +515,10 @@
element: source,
stripOuter: true,
success: function(text){
- let ttext = $.trim(text);
+ let ttext = text;
+ if (trim) {
+ ttext = ttext.trim();
+ }
$('textarea', $overlay).val(ttext);
setTimeout(function(){
@@ -569,19 +572,19 @@
var textAreaOpened = $('textarea', $overlay)[0];
var startTag = "";
var endTag = "";
- var buttonName = this.innerHTML;
-
- if(buttonName == "sÅowo obce") {
- startTag = "";
- endTag = " ";
- } else if (buttonName == "wyróżnienie") {
- startTag = "";
- endTag = " ";
- } else if (buttonName == "tytuÅ dzieÅa") {
- startTag = "";
- endTag = " ";
- } else if(buttonName == "znak spec."){
- addSymbol();
+ var tag = "";
+ var $this = $(this);
+
+ if ($this.data('tag')) {
+ tag = $this.data('tag');
+ startTag = "<" + $this.data('tag') + ">";
+ endTag = "" + $this.data('tag') + ">";
+ } else if ($this.data('tag-selfclosing')){
+ startTag = "<" + $this.data('tag-selfclosing') + "/>";
+ } else if ($this.data('act')) {
+ if ($this.data('act') == 'spec') {
+ addSymbol();
+ }
return false;
}
@@ -645,15 +648,19 @@
$('#html-view').bind('mousemove', function(event){
var editable = $(event.target).closest('*[x-editable]');
- $('.active', element).not(editable).removeClass('active').children('.active-block-button').remove();
+ $('.active', element).not(editable).removeClass('active').children('.html-editarea-toolbar').remove();
if (!editable.hasClass('active')) {
- editable.addClass('active').append(button);
+ var toolbar = $("")
+ editable.append(toolbar);
+ var buttonSpace = $('.html-editarea-toolbar-left', toolbar);
+ editable.addClass('active');
+ buttonSpace.append(button);
if (!editable.is('[x-edit-attribute]') &&
!editable.is('.annotation-inline-box') &&
!editable.is('[x-edit-no-format]')
) {
- editable.append(uwagaButton);
+ buttonSpace.append(uwagaButton);
}
}
if (editable.is('.annotation-inline-box')) {
@@ -717,13 +724,13 @@
$(document).on('click', '.edit-button', function(event){
self.flush();
event.preventDefault();
- openForEdit($(this).parent());
+ openForEdit($(this).closest('.html-editarea-toolbar').parent());
});
$(document).on('click', '.uwaga-button', function(event){
self.flush();
event.preventDefault();
- createUwagaBefore($(this).parent());
+ createUwagaBefore($(this).closest('.html-editarea-toolbar').parent());
});
}
@@ -756,7 +763,6 @@
let self = this;
xml2html({
xml: this.doc.text,
- base: this.doc.getBase(),
success: function(element){
var htmlView = $('#html-view');
@@ -951,6 +957,7 @@
let $e = $(e);
if ($e.closest('[x-node="abstrakt"]').length) return;
if ($e.closest('[x-node="nota_red"]').length) return;
+ if ($e.closest('[x-annotation-box="true"]').length) return;
let node = $e.attr('x-node');
if (node == 'numeracja') {
number = 0;