function parseUrls(e) {
let domains = element.value.split('\n');
const re = /(?:[\w-]+\..)+[\w-]+/g;
element.value = "";
for (let i = 0, ln = domains.length; i < ln; ++i) {
element.value += re.exec(domains[i]) + '\n';
re.exec(domains[i]);
}
}
function updateURLParameter(url, param, paramVal){
var newAdditionalURL = "";
var tempArray = url.split("?");
var baseURL = tempArray[0];
var additionalURL = tempArray[1];
var temp = "";
if (additionalURL) {
tempArray = additionalURL.split("&");
for (var i=0; i<tempArray.length; i++){
if(tempArray[i].split('=')[0] != param){
newAdditionalURL += temp + tempArray[i];
temp = "&";
}
}
}
var rows_txt = temp + "" + param + "=" + paramVal;
return baseURL + "?" + newAdditionalURL + rows_txt;
}
function addParam(v) {
var newURL = updateURLParameter(window.location.href, 'locId', 'newLoc');
newURL = updateURLParameter(newURL, 'resId', 'newResId');
window.history.replaceState('', '', updateURLParameter(window.location.href, "t", v));
location.reload();
}
<a href="javascript:addParam('4');">...</a>
<a href="javascript:addParam('5');">...</a>
<script src="https://cdn.ckeditor.com/ckeditor5/21.0.0/balloon-block/ckeditor.js"></script>
<script src="https://cdn.ckeditor.com/ckeditor5/21.0.0/balloon-block/translations/ru.js"></script>
<script>
const textarea = document.querySelector( '#editor' );
BalloonEditor.create( textarea , {
language: 'ru',
removePlugins: [ 'Table' ],
toolbar: [ 'bold', 'italic', 'bulletedList', 'numberedList', 'blockQuote' ]
})
.then( editor => {
window.editor = editor;
editor.model.document.on( 'change:data', ( evt, data ) => {
console.log( data );
$('textarea#tickets-editor').html( editor.getData() );
} );
} )
.catch( error => {
console.error( 'There was a problem initializing the editor.', error );
} );
</script>
.then( editor => {...}
код добавить:.then( editor => {
window.editor = editor;
editor.model.document.on( 'change:data', ( evt, data ) => {
console.log( data );
$('textarea#tickets-editor').html( editor.getData() );
} );
} )
jQuery(document).ready(function($) {
$('.navbar-toggler').each(function () {
$(this).click(function() {
$('.navbar-toggler').toggleClass('active');
$('.bs-canvas-overlay').toggleClass('show');
$('.bs-canvas').toggleClass('active');;
return false;
})
});
jQuery(document).ready(function($) {
let bsDefaults = {
offset: false,
overlay: true,
width: '330px'
};
let bsMain = $('.bs-offset-main');
let bsOverlay = $('.bs-canvas-overlay');
$('.nav-link-collapse').on('click', function() {
$('.nav-link-collapse').not(this).removeClass('nav-link-show');
$(this).toggleClass('nav-link-show');
});
let documentMenu = {
isOpen: false,
hamburgerToggle: () => {
if (documentMenu.isOpen === false) {
$('.cmn-toggle-switch').addClass("active");
// documentMenu.open();
} else {
$('.cmn-toggle-switch').removeClass("active");
// documentMenu.close();
}
documentMenu.isOpen = !documentMenu.isOpen;
},
open: () => {
documentMenu.hamburgerToggle();
let canvas = $('[data-toggle="canvas"][aria-expanded="false"]').data('target'),
opts = $.extend({}, bsDefaults, $(canvas).data()),
prop = $(canvas).hasClass('bs-canvas-right') ? 'margin-right' : 'margin-left';
if (opts.width === '100%')
opts.offset = false;
$(canvas).css('width', opts.width);
if (opts.offset && bsMain.length)
bsMain.css(prop, opts.width);
$(canvas + ' .bs-canvas-close').attr('aria-expanded', "true");
$('[data-toggle="canvas"][data-target="' + canvas + '"]').attr('aria-expanded', "true");
if (opts.overlay && bsOverlay.length)
bsOverlay.addClass('show');
return false;
},
close: () => {
documentMenu.hamburgerToggle();
let canvas, aria;
let object = $('.bs-canvas-close, .bs-canvas-overlay');
if ($(object).hasClass('bs-canvas-close')) {
canvas = $(object).closest('.bs-canvas');
aria = $(object).add($('[data-toggle="canvas"][data-target="#' + canvas.attr('id') + '"]'));
if (bsMain.length)
bsMain.css(($(canvas).hasClass('bs-canvas-right') ? 'margin-right' : 'margin-left'), '');
} else {
canvas = $('.bs-canvas');
aria = $('.bs-canvas-close, [data-toggle="canvas"]');
if (bsMain.length)
bsMain.css({
'margin-left': '',
'margin-right': ''
});
}
canvas.css('width', '');
aria.attr('aria-expanded', "false");
if (bsOverlay.length)
bsOverlay.removeClass('show');
return false;
}
};
$('.cmn-toggle-switch').on('click', function(e){
e.preventDefault();
if (documentMenu.isOpen === false)
documentMenu.open();
else
documentMenu.close();
});
$('.bs-canvas-close, .bs-canvas-overlay').on('click', function() {
documentMenu.close();
});
});