mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 03:25:23 +08:00
@@ -74,45 +74,6 @@
|
||||
return host.addElement(contentType);
|
||||
};
|
||||
|
||||
$scope.toggleInlineEditing = function () {
|
||||
if (!$scope.element.inlineEditingIsActive) {
|
||||
$scope.element.inlineEditingIsActive = true;
|
||||
$element.find(".layout-toolbar-container").show();
|
||||
var selector = "#layout-editor-" + $scope.$id + " .layout-html .layout-content-markup[data-templated=false]";
|
||||
var firstContentEditorId = $(selector).first().attr("id");
|
||||
tinymce.init({
|
||||
selector: selector,
|
||||
theme: "modern",
|
||||
schema: "html5",
|
||||
plugins: [
|
||||
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
|
||||
"searchreplace wordcount visualblocks visualchars code fullscreen",
|
||||
"insertdatetime media nonbreaking table contextmenu directionality",
|
||||
"emoticons template paste textcolor colorpicker textpattern",
|
||||
"fullscreen autoresize"
|
||||
],
|
||||
toolbar: "undo redo cut copy paste | bold italic | bullist numlist outdent indent formatselect | alignleft aligncenter alignright alignjustify ltr rtl | link unlink charmap | code fullscreen close",
|
||||
convert_urls: false,
|
||||
valid_elements: "*[*]",
|
||||
// Shouldn't be needed due to the valid_elements setting, but TinyMCE would strip script.src without it.
|
||||
extended_valid_elements: "script[type|defer|src|language]",
|
||||
statusbar: false,
|
||||
skin: "orchardlightgray",
|
||||
inline: true,
|
||||
fixed_toolbar_container: "#layout-editor-" + $scope.$id + " .layout-toolbar-container",
|
||||
init_instance_callback: function (editor) {
|
||||
if (editor.id == firstContentEditorId)
|
||||
tinymce.execCommand("mceFocus", false, editor.id);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
tinymce.remove("#layout-editor-" + $scope.$id + " .layout-content-markup");
|
||||
$element.find(".layout-toolbar-container").hide();
|
||||
$scope.element.inlineEditingIsActive = false;
|
||||
}
|
||||
};
|
||||
|
||||
$(document).on("cut copy paste", function (e) {
|
||||
// If the pseudo clipboard was already invoked (which happens on the first clipboard
|
||||
// operation after page load even if native clipboard support exists) then sit this
|
||||
@@ -164,23 +125,12 @@
|
||||
element.find(".layout-toolbar-container").click(function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
// Intercept mousedown on editor while in inline editing mode to
|
||||
// prevent current editor from losing focus.
|
||||
element.mousedown(function (e) {
|
||||
if (scope.element.inlineEditingIsActive) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
})
|
||||
// Unfocus and unselect everything on click outside of canvas.
|
||||
$(window).click(function (e) {
|
||||
// Except when in inline editing mode.
|
||||
if (!scope.element.inlineEditingIsActive) {
|
||||
scope.$apply(function () {
|
||||
scope.element.activeElement = null;
|
||||
scope.element.focusedElement = null;
|
||||
});
|
||||
}
|
||||
scope.$apply(function () {
|
||||
scope.element.activeElement = null;
|
||||
scope.element.focusedElement = null;
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@@ -35,13 +35,6 @@
|
||||
templateUrl: environment.templateUrl("Html"),
|
||||
replace: true,
|
||||
link: function (scope, element) {
|
||||
// Mouse down events must not be intercepted by drag and drop while inline editing is active,
|
||||
// otherwise clicks in inline editors will have no effect.
|
||||
element.find(".layout-content-markup").mousedown(function (e) {
|
||||
if (scope.element.editor.inlineEditingIsActive) {
|
||||
e.stopPropagation();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
var resetFocus = false;
|
||||
var element = $scope.element;
|
||||
|
||||
if (element.editor.isDragging || element.editor.inlineEditingIsActive)
|
||||
if (element.editor.isDragging)
|
||||
return;
|
||||
|
||||
// If native clipboard support exists, the pseudo-clipboard will have been disabled.
|
||||
|
@@ -9,7 +9,6 @@
|
||||
this.focusedElement = null;
|
||||
this.dropTargetElement = null;
|
||||
this.isDragging = false;
|
||||
this.inlineEditingIsActive = false;
|
||||
this.isResizing = false;
|
||||
|
||||
this.resetToolboxElements = function () {
|
||||
|
@@ -56,7 +56,7 @@
|
||||
this.setIsActive = function (value) {
|
||||
if (!this.editor)
|
||||
return;
|
||||
if (this.editor.isDragging || this.editor.inlineEditingIsActive || this.editor.isResizing)
|
||||
if (this.editor.isDragging || this.editor.isResizing)
|
||||
return;
|
||||
|
||||
if (value)
|
||||
@@ -76,7 +76,7 @@
|
||||
return;
|
||||
if (this.isTemplated)
|
||||
return;
|
||||
if (this.editor.isDragging || this.editor.inlineEditingIsActive || this.editor.isResizing)
|
||||
if (this.editor.isDragging || this.editor.isResizing)
|
||||
return;
|
||||
|
||||
this.editor.focusedElement = this;
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,10 +1,6 @@
|
||||
<div class="layout-toolbox-wrapper">
|
||||
<div class="layout-toolbox">
|
||||
<label>
|
||||
<input type="checkbox" ng-checked="element.inlineEditingIsActive" ng-click="toggleInlineEditing()" />
|
||||
@T("Edit HTML content inline")
|
||||
</label>
|
||||
<ul class="layout-toolbox-groups" ng-hide="element.inlineEditingIsActive">
|
||||
<ul class="layout-toolbox-groups">
|
||||
<li class="layout-toolbox-group" ng-class="{collapsed: layoutIsCollapsed}">
|
||||
<a href="#" class="layout-toolbox-group-heading" ng-click="toggleLayoutIsCollapsed($event)">@T("Layout")</a>
|
||||
<ul class="layout-toolbox-items">
|
||||
|
Reference in New Issue
Block a user