Commit e1b09cd2 authored by Ifaliana Arimanana's avatar Ifaliana Arimanana
Browse files

uppppppp

parent 15d5cebd
......@@ -1017,7 +1017,7 @@ foreach ($cmsList as $e => $v) {
#toolsBar {
left: 20%;
top: 40%;
top: 10%;
max-width: 650px;
z-index: 99999;
position: fixed;
......
......@@ -448,14 +448,10 @@ jQuery.fn.removeClassExcept = function (val) {
superCms<?= $kunik ?>.editMode();
$(document).keyup(function(e) {
if (e.key === "Control") {
$(document).keyup(function(e) {
if (e.key === "Shift") {
if (e.altKey == true && e.keyCode == 80) {
superCms<?= $kunik ?>.viewMode();
$("#toolsBar").hide();
}
});
}
});
$(".view-super-cms").click(function(){
......
......@@ -369,17 +369,14 @@ jQuery.fn.removeClassExcept = function (val) {
}
}
$(document).keyup(function(e) {
if (e.key === "Control") {
$(document).keyup(function(e) {
if (e.key === "Shift") {
$(document).keyup(function(e) {
if (e.altKey == true && e.keyCode == 80) {
superCms<?= $kunik ?>.viewMode();
$("#toolsBar").hide();
$("#toolsBar").hide();
}
});
}
});
$(".view-super-cms").click(function(){
superCms<?= $kunik ?>.viewMode();
$("#toolsBar").hide();
......
......@@ -207,16 +207,13 @@ $padding = max($paddingtop,$paddingright,$paddingleft,$paddingbottom);
}
$(document).keyup(function(e) {
if (e.key === "Control") {
$(document).keyup(function(e) {
if (e.key === "Shift") {
$(document).keyup(function(e) {
if (e.altKey == true && e.keyCode == 80) {
superCms<?= $kunik ?>.viewMode();
$("#toolsBar").hide();
$("#toolsBar").hide();
}
});
}
});
$(".view-super-cms").click(function(){
superCms<?= $kunik ?>.viewMode();
......
......@@ -180,86 +180,6 @@ ce.addEventListener('paste', function (e) {
})
/*************Keep selected text when focus on input color*************/
var saveSelection<?= $myCmsId ?>, restoreSelection<?= $myCmsId ?>;
if (window.getSelection && document.createRange) {
saveSelection<?= $myCmsId ?> = function(containerEl) {
var doc = containerEl.ownerDocument, win = doc.defaultView;
var range = win.getSelection().getRangeAt(0);
var preSelectionRange = range.cloneRange();
preSelectionRange.selectNodeContents(containerEl);
preSelectionRange.setEnd(range.startContainer, range.startOffset);
var start = preSelectionRange.toString().length;
return {
start: start,
end: start + range.toString().length
}
};
restoreSelection<?= $myCmsId ?> = function(containerEl, savedSel) {
var doc = containerEl.ownerDocument, win = doc.defaultView;
var charIndex = 0, range = doc.createRange();
range.setStart(containerEl, 0);
range.collapse(true);
var nodeStack = [containerEl], node, foundStart = false, stop = false;
while (!stop && (node = nodeStack.pop())) {
if (node.nodeType == 3) {
var nextCharIndex = charIndex + node.length;
if (!foundStart && savedSel.start >= charIndex && savedSel.start <= nextCharIndex) {
range.setStart(node, savedSel.start - charIndex);
foundStart = true;
}
if (foundStart && savedSel.end >= charIndex && savedSel.end <= nextCharIndex) {
range.setEnd(node, savedSel.end - charIndex);
stop = true;
}
charIndex = nextCharIndex;
} else {
var i = node.childNodes.length;
while (i--) {
nodeStack.push(node.childNodes[i]);
}
}
}
var sel = win.getSelection();
sel.removeAllRanges();
sel.addRange(range);
}
} else if (document.selection) {
saveSelection<?= $myCmsId ?> = function(containerEl) {
var doc = containerEl.ownerDocument, win = doc.defaultView || doc.parentWindow;
var selectedTextRange = doc.selection.createRange();
var preSelectionTextRange = doc.body.createTextRange();
preSelectionTextRange.moveToElementText(containerEl);
preSelectionTextRange.setEndPoint("EndToStart", selectedTextRange);
var start = preSelectionTextRange.text.length;
return {
start: start,
end: start + selectedTextRange.text.length
}
};
restoreSelection<?= $myCmsId ?> = function(containerEl, savedSel) {
var doc = containerEl.ownerDocument, win = doc.defaultView || doc.parentWindow;
var textRange = doc.body.createTextRange();
textRange.moveToElementText(containerEl);
textRange.collapse(true);
textRange.moveEnd("character", savedSel.end);
textRange.moveStart("character", savedSel.start);
textRange.select();
};
}
var divSelection;
var editable = $("#<?= $myCmsId ?>textShow")[0];
/*************END Keep selected text when focus on input color*************/
/*function replace_content<?= $myCmsId ?>(content)
{
......@@ -293,15 +213,11 @@ function convAndCheckLink<?= $myCmsId ?>(){
/************Preview and read mode************/
$(document).keyup(function(e) {
if (e.key === "Control") {
$(document).keyup(function(e) {
if (e.key === "Shift") {
if (e.altKey == true && e.keyCode == 80) {
mode = "v"
convAndCheckLink<?= $myCmsId ?>();
document.getElementById("<?= $myCmsId ?>textShow").contentEditable = "false";
}
});
}
});
$(".view-super-cms").click(function(){
......@@ -317,7 +233,7 @@ $(".view-super-cms").click(function(){
allText = allText.replace(x.outerHTML, "["+x.innerText+"]("+x.href+")");
});
$("#<?= $myCmsId ?>textShow").html(allText);
document.getElementById("<?= $myCmsId ?>textShow").contentEditable = "false";
document.getElementById("<?= $myCmsId ?>textShow").contentEditable = "true";
}
});
......@@ -425,7 +341,8 @@ $(".view-super-cms").click(function(){
/**************Open text settings panel**************/
$(".<?= $myCmsId ?>-<?= $keyTpl ?>").on("mouseup", function () {
divSelection = saveSelection<?= $myCmsId ?>(editable);
editable = $("#<?= $myCmsId ?>textShow")[0];
divSelection = saveSelection(editable);
});
$(".<?= $myCmsId ?>-<?= $keyTpl ?>").on("mousedown", function () {
sel = window.getSelection();
......@@ -512,7 +429,7 @@ $(".view-super-cms").click(function(){
$( "#myColor" ).change(function() {
var mycolor = "";
restoreSelection<?= $myCmsId ?>(editable, divSelection);
restoreSelection(editable, divSelection);
mycolor = document.getElementById("myColor").value;
setTimeout(function(){
document.execCommand('foreColor', false, mycolor);
......
......@@ -1192,5 +1192,94 @@ $('body').on('click',"button.btn-filter", function () {
if (<?= json_encode($idCmsMerged) ?> == "" && <?= json_encode($btnSaveChange) ?>) {
tplObj.removeCmsList(tplUsingId);
}
/*************Keep selected text when focus on input color*************/
var saveSelection, restoreSelection;
if (window.getSelection && document.createRange) {
saveSelection = function(containerEl) {
var doc = containerEl.ownerDocument, win = doc.defaultView;
var range = win.getSelection().getRangeAt(0);
var preSelectionRange = range.cloneRange();
preSelectionRange.selectNodeContents(containerEl);
preSelectionRange.setEnd(range.startContainer, range.startOffset);
var start = preSelectionRange.toString().length;
return {
start: start,
end: start + range.toString().length
}
};
restoreSelection = function(containerEl, savedSel) {
var doc = containerEl.ownerDocument, win = doc.defaultView;
var charIndex = 0, range = doc.createRange();
range.setStart(containerEl, 0);
range.collapse(true);
var nodeStack = [containerEl], node, foundStart = false, stop = false;
while (!stop && (node = nodeStack.pop())) {
if (node.nodeType == 3) {
var nextCharIndex = charIndex + node.length;
if (!foundStart && savedSel.start >= charIndex && savedSel.start <= nextCharIndex) {
range.setStart(node, savedSel.start - charIndex);
foundStart = true;
}
if (foundStart && savedSel.end >= charIndex && savedSel.end <= nextCharIndex) {
range.setEnd(node, savedSel.end - charIndex);
stop = true;
}
charIndex = nextCharIndex;
} else {
var i = node.childNodes.length;
while (i--) {
nodeStack.push(node.childNodes[i]);
}
}
}
var sel = win.getSelection();
sel.removeAllRanges();
sel.addRange(range);
}
} else if (document.selection) {
saveSelection = function(containerEl) {
var doc = containerEl.ownerDocument, win = doc.defaultView || doc.parentWindow;
var selectedTextRange = doc.selection.createRange();
var preSelectionTextRange = doc.body.createTextRange();
preSelectionTextRange.moveToElementText(containerEl);
preSelectionTextRange.setEndPoint("EndToStart", selectedTextRange);
var start = preSelectionTextRange.text.length;
return {
start: start,
end: start + selectedTextRange.text.length
}
};
restoreSelection = function(containerEl, savedSel) {
var doc = containerEl.ownerDocument, win = doc.defaultView || doc.parentWindow;
var textRange = doc.body.createTextRange();
textRange.moveToElementText(containerEl);
textRange.collapse(true);
textRange.moveEnd("character", savedSel.end);
textRange.moveStart("character", savedSel.start);
textRange.select();
};
}
var divSelection;
var editable = null;
/*************END Keep selected text when focus on input color*************/
$(document).keyup(function(e) {
if (e.altKey == true && e.keyCode == 80) {
tplObj.previewTpl();
}
});
</script>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment