fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New covers.
[redakcja.git]
/
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
7b4069c
..
e5b0796
100644
(file)
--- a/
src/redakcja/static/js/wiki/view_editor_wysiwyg.js
+++ b/
src/redakcja/static/js/wiki/view_editor_wysiwyg.js
@@
-479,9
+479,20
@@
};
});
}
};
});
}
- else if($box.is('*[x-annotation-box]') || $origin.is('*[x-edit-attribute]')) {
+ else if($box.is('*[x-annotation-box]') || $origin.is('*[x-edit-attribute]') || $origin.is('*[x-node="uwaga"]')) {
+ let q;
+ switch ($origin.attr('x-node')) {
+ case 'uwaga':
+ q = 'tę uwagę';
+ break;
+ case 'ref':
+ q = 'tę referencję';
+ break
+ default:
+ q = 'ten przypis';
+ }
$('.delete-button', $overlay).click(function(){
$('.delete-button', $overlay).click(function(){
- if (window.confirm("Czy jesteś pewien, że chcesz usunąć
ten przypis
?")) {
+ if (window.confirm("Czy jesteś pewien, że chcesz usunąć
" + q + "
?")) {
$origin.remove();
$overlay.remove();
$(document).unbind('click.blur-overlay');
$origin.remove();
$overlay.remove();
$(document).unbind('click.blur-overlay');
@@
-505,7
+516,7
@@
if($box.attr("x-edit-attribute")) {
source = $('<span x-pass-thru="true"/>');
if($box.attr("x-edit-attribute")) {
source = $('<span x-pass-thru="true"/>');
- source.text($box.attr("
data-wlf
-" + $box.attr("x-edit-attribute")));
+ source.text($box.attr("
x-a-wl
-" + $box.attr("x-edit-attribute")));
source = source[0];
} else {
source = $box[0];
source = source[0];
} else {
source = $box[0];
@@
-621,6
+632,16
@@
});
}
});
}
+ function createUwagaBefore(before) {
+ xml2html({
+ xml: '<uwaga/>',
+ success: function(element){
+ let $element = $(element);
+ $element.insertBefore(before);
+ openForEdit($element);
+ }
+ });
+ }
function VisualPerspective(options){
perspective = this;
function VisualPerspective(options){
perspective = this;
@@
-629,26
+650,25
@@
options.callback = function(){
var element = $("#html-view");
options.callback = function(){
var element = $("#html-view");
- var button = $('<button class="edit-button">Edytuj</button>');
+ var button = $('<button class="edit-button active-block-button">Edytuj</button>');
+ var uwagaButton = $('<button class="uwaga-button active-block-button">Uwaga</button>');
if (!CurrentDocument.readonly) {
$('#html-view').bind('mousemove', function(event){
var editable = $(event.target).closest('*[x-editable]');
if (!CurrentDocument.readonly) {
$('#html-view').bind('mousemove', function(event){
var editable = $(event.target).closest('*[x-editable]');
- $('.active', element).not(editable).removeClass('active').children('.
edit
-button').remove();
+ $('.active', element).not(editable).removeClass('active').children('.
active-block
-button').remove();
if (!editable.hasClass('active')) {
editable.addClass('active').append(button);
if (!editable.hasClass('active')) {
editable.addClass('active').append(button);
+ if (!editable.is('[x-edit-attribute]')) {
+ editable.append(uwagaButton);
+ }
}
if (editable.is('.annotation-inline-box')) {
$('*[x-annotation-box]', editable).css({
}
if (editable.is('.annotation-inline-box')) {
$('*[x-annotation-box]', editable).css({
-// left: event.clientX - editable.offset().left + 5,
-// top: event.clientY - editable.offset().top + 5
}).show();
}
}).show();
}
- else {
-// $('*[x-annotation-box]').hide();
- }
});
perspective.caret = new Caret(element);
});
perspective.caret = new Caret(element);
@@
-685,6
+705,10
@@
openForEdit($(this).parent());
});
openForEdit($(this).parent());
});
+ $(document).on('click', '.uwaga-button', function(event){
+ event.preventDefault();
+ createUwagaBefore($(this).parent());
+ });
}
$(document).on('click', '[x-node="motyw"]', function(){
}
$(document).on('click', '[x-node="motyw"]', function(){
@@
-727,14
+751,6
@@
var htmlView = $('#html-view');
htmlView.html(element);
var htmlView = $('#html-view');
htmlView.html(element);
- htmlView.find('*[x-node]').dblclick(function(e) {
- if($(e.target).is('textarea'))
- return;
- var selection = window.getSelection();
- selection.collapseToStart();
- selection.modify('extend', 'forward', 'word');
- e.stopPropagation();
- });
_finalize(success);
},
error: function(text, source){
_finalize(success);
},
error: function(text, source){
@@
-751,6
+767,8
@@
var self = this;
self.caret.detach();
var self = this;
self.caret.detach();
+
+ $.wiki.exitTab('#PropertiesPerspective');
$.blockUI({
message: 'Zapisywanie widoku...'
$.blockUI({
message: 'Zapisywanie widoku...'
@@
-784,7
+802,7
@@
let selection = window.getSelection();
var n = selection.rangeCount;
let selection = window.getSelection();
var n = selection.rangeCount;
- if (n != 1) {
+ if (n != 1
|| selection.isCollapsed
) {
window.alert("Nie zaznaczono obszaru");
return false
}
window.alert("Nie zaznaczono obszaru");
return false
}