X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/9d566b4741eb66bf09b5c7d213aa8541886e100a..573b9004c7bc2a6a2b29335155b4ff55d142c6b6:/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 c8f84e1f..f39f7a87 100644
--- a/src/redakcja/static/js/wiki/view_editor_wysiwyg.js
+++ b/src/redakcja/static/js/wiki/view_editor_wysiwyg.js
@@ -609,89 +609,81 @@
class VisualPerspective extends $.wiki.Perspective {
constructor(options) {
- var old_callback = options.callback;
-
- options.callback = function(){
- let self = this;
- var element = $("#html-view");
- var button = $('');
- var uwagaButton = $('');
-
- if (!CurrentDocument.readonly) {
-
- $('#html-view').bind('mousemove', function(event){
- var editable = $(event.target).closest('*[x-editable]');
- $('.active', element).not(editable).removeClass('active').children('.active-block-button').remove();
-
- if (!editable.hasClass('active')) {
- editable.addClass('active').append(button);
- if (!editable.is('[x-edit-attribute]') &&
- !editable.is('.annotation-inline-box') &&
- !editable.is('[x-edit-no-format]')
- ) {
- editable.append(uwagaButton);
- }
- }
- if (editable.is('.annotation-inline-box')) {
- $('*[x-annotation-box]', editable).css({
- }).show();
+ super(options);
+ let self = this;
+ var element = $("#html-view");
+ var button = $('');
+ var uwagaButton = $('');
+
+ if (!CurrentDocument.readonly) {
+
+ $('#html-view').bind('mousemove', function(event){
+ var editable = $(event.target).closest('*[x-editable]');
+ $('.active', element).not(editable).removeClass('active').children('.active-block-button').remove();
+
+ if (!editable.hasClass('active')) {
+ editable.addClass('active').append(button);
+ if (!editable.is('[x-edit-attribute]') &&
+ !editable.is('.annotation-inline-box') &&
+ !editable.is('[x-edit-no-format]')
+ ) {
+ editable.append(uwagaButton);
}
- });
-
- self.caret = new Caret(element);
-
- $('#insert-reference-button').click(function(){
- self.addReference();
- return false;
- });
-
- $('#insert-annotation-button').click(function(){
- addAnnotation();
- return false;
- });
+ }
+ if (editable.is('.annotation-inline-box')) {
+ $('*[x-annotation-box]', editable).css({
+ }).show();
+ }
+ });
- $('#insert-theme-button').click(function(){
- addTheme();
- return false;
- });
+ self.caret = new Caret(element);
+ $('#insert-reference-button').click(function(){
+ self.addReference();
+ return false;
+ });
- $(".insert-inline-tag").click(function() {
- self.insertInlineTag($(this).attr('data-tag'));
- return false;
- });
+ $('#insert-annotation-button').click(function(){
+ addAnnotation();
+ return false;
+ });
- $(".insert-char").click(function() {
- addSymbol(caret=self.caret);
- return false;
- });
+ $('#insert-theme-button').click(function(){
+ addTheme();
+ return false;
+ });
- $(document).on('click', '.edit-button', function(event){
- event.preventDefault();
- openForEdit($(this).parent());
- });
+ $(".insert-inline-tag").click(function() {
+ self.insertInlineTag($(this).attr('data-tag'));
+ return false;
+ });
- $(document).on('click', '.uwaga-button', function(event){
- event.preventDefault();
- createUwagaBefore($(this).parent());
- });
- }
+ $(".insert-char").click(function() {
+ addSymbol(caret=self.caret);
+ return false;
+ });
- $(document).on('click', '[x-node="motyw"]', function(){
- selectTheme($(this).attr('theme-class'));
+ $(document).on('click', '.edit-button', function(event){
+ event.preventDefault();
+ openForEdit($(this).parent());
});
- element.on('click', '.annotation', function(event) {
+ $(document).on('click', '.uwaga-button', function(event){
event.preventDefault();
- event.redakcja_caret_ignore = true;
- $('[x-annotation-box]', $(this).parent()).toggleClass('editing');
- self.caret.detach();
+ createUwagaBefore($(this).parent());
});
+ }
- old_callback.call(this);
- };
+ $(document).on('click', '[x-node="motyw"]', function(){
+ selectTheme($(this).attr('theme-class'));
+ });
- super(options);
+ element.on('click', '.annotation', function(event) {
+ event.preventDefault();
+ event.redakcja_caret_ignore = true;
+ $('[x-annotation-box]', $(this).parent()).toggleClass('editing');
+ self.caret.detach();
+ });
}
onEnter(success, failure) {