Skip to content

Commit

Permalink
Merge branch 'v8/8.2' into v8/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Shazwazza committed Sep 27, 2019
2 parents 52c4a57 + cf36268 commit 99d2bef
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 22 deletions.
44 changes: 37 additions & 7 deletions src/Umbraco.Web.UI.Client/src/common/filters/truncate.filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,58 @@
* @namespace truncateFilter
*
* param {any} wordwise if true, the string will be cut after last fully displayed word.
* param {any} max max length of the outputtet string
* param {any} tail option tail, defaults to: ' ...'
*
* param {any} max where to cut the string.
* param {any} tail option tail, defaults to: '…'
*
* Legacy version:
* parameter noOfChars(wordwise) Where to cut the string.
* parameter appendDots(max) If true dots will be appended in the end.
*
* @description
* Limits the length of a string, if a cut happens only the string will be appended with three dots to indicate that more is available.
*/
angular.module("umbraco.filters").filter('truncate',
function () {
return function (value, wordwise, max, tail) {

if (!value) return '';

/*
Overload-fix to support Forms Legacy Version:
We are making this hack to support the old Forms version of the truncate filter.
The old version took different attributes, this code block checks if the first argument isnt a boolean, meaning its not the new version, meaning that the filter is begin used in the old way.
Therefor we use the second argument(max) to indicate wether we want a tail (…) and using the first argument(wordwise) as the second argument(max amount of characters)
*/
if (typeof(wordwise) !== 'boolean') {
// switch arguments around to fit Forms version.
if (max !== true) {
tail = '';
}
max = wordwise;
wordwise = false;
}
// !end of overload fix.

max = parseInt(max, 10);
if (!max) return value;
if (value.length <= max) return value;


tail = (!tail && tail !== '') ? '…' : tail;

if (wordwise && value.substr(max, 1) === ' ') {
max++;
}
value = value.substr(0, max);

if (wordwise) {
var lastspace = value.lastIndexOf(' ');
if (lastspace != -1) {
value = value.substr(0, lastspace);
if (lastspace !== -1) {
value = value.substr(0, lastspace+1);
}
}
return value + (tail || (wordwise ? ' …' : '…'));

return value + tail;
};
}
);
43 changes: 37 additions & 6 deletions src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,16 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
}
}

function isMediaPickerEnabled(toolbarItemArray){
var insertMediaButtonFound = false;
toolbarItemArray.forEach(toolbarItem => {
if(toolbarItem.indexOf("umbmediapicker") > -1){
insertMediaButtonFound = true;
}
});
return insertMediaButtonFound;
}

return {

/**
Expand Down Expand Up @@ -338,15 +348,21 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
body_class: "umb-rte",

//see http://archive.tinymce.com/wiki.php/Configuration:cache_suffix
cache_suffix: "?umb__rnd=" + Umbraco.Sys.ServerVariables.application.cacheBuster,
cache_suffix: "?umb__rnd=" + Umbraco.Sys.ServerVariables.application.cacheBuster
};

// Need to check if we are allowed to UPLOAD images
// This is done by checking if the insert image toolbar button is available
if(isMediaPickerEnabled(args.toolbar)){
// Update the TinyMCE Config object to allow pasting
config.images_upload_handler = uploadImageHandler;
config.automatic_uploads = false;
config.images_replace_blob_uris = false;

// This allows images to be pasted in & stored as Base64 until they get uploaded to server
paste_data_images: true,
config.paste_data_images = true;
}

images_upload_handler: uploadImageHandler,
automatic_uploads: false,
images_replace_blob_uris: false
};

if (args.htmlId) {
config.selector = "#" + args.htmlId;
Expand Down Expand Up @@ -1249,6 +1265,21 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
startWatch();
}

// If we can not find the insert image/media toolbar button
// Then we need to add an event listener to the editor
// That will update native browser drag & drop events
// To update the icon to show you can NOT drop something into the editor
var toolbarItems = args.editor.settings.toolbar.split(" ");
if(isMediaPickerEnabled(toolbarItems) === false){
// Wire up the event listener
args.editor.on('dragend dragover draggesture dragdrop drop drag', function (e) {
e.preventDefault();
e.dataTransfer.effectAllowed = "none";
e.dataTransfer.dropEffect = "none";
e.stopPropagation();
});
}

args.editor.on('SetContent', function (e) {
var content = e.content;

Expand Down
3 changes: 1 addition & 2 deletions src/Umbraco.Web.UI.Client/src/less/components/umb-grid.less
Original file line number Diff line number Diff line change
Expand Up @@ -637,8 +637,7 @@
}

.umb-grid .mce-toolbar {
border-bottom: 1px solid @gray-8;
background-color: rgba(250, 250, 250, 1);
border-bottom: 1px solid @gray-7;
display: none;
}

Expand Down
87 changes: 83 additions & 4 deletions src/Umbraco.Web.UI.Client/src/less/rte.less
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,15 @@
}
*/

.mce-ico {
.umb-rte .mce-ico {
text-align: center;
font-size: 12px !important;
/*color: @gray-1 !important;*/
}

/* Special case to support helviticons for the tiny mce button controls */
.mce-ico.mce-i-custom[class^="icon-"],
.mce-ico.mce-i-custom[class*=" icon-"] {
.umb-rte .mce-ico.mce-i-custom[class^="icon-"],
.umb-rte .mce-ico.mce-i-custom[class*=" icon-"] {
font-family: icomoon;
font-size: 16px !important;
}
Expand All @@ -81,6 +82,84 @@
}
}

.mce-fullscreen {
.umb-rte .mce-fullscreen {
position:absolute;
}

.umb-rte .mce-toolbar .mce-btn-group {
padding: 0;
}

.umb-rte .mce-btn {
color: @ui-action-type;
border-radius: 3px;
}

.umb-rte .mce-btn-group .mce-btn {
margin-top:2px;
margin-bottom:2px;
}

.umb-rte .mce-btn {
button:hover {
.mce-caret {
border-top-color: @ui-action-type-hover;
}
}
}

.umb-rte .mce-btn:hover, .umb-rte .mce-btn:active {
background: @ui-action-hover;
border-color: transparent;
button {
color: @ui-action-type-hover;
.mce-ico {
color: @ui-action-type-hover;
}
}
}

.umb-rte .mce-btn.mce-active, .umb-rte .mce-btn.mce-active:active,
.umb-rte .mce-btn.mce-active:hover, .umb-rte .mce-btn.mce-active:focus {
background: @gray-9;
border-color: transparent;
button {
color: @ui-action-type-hover;
.mce-ico {
color: @ui-action-type-hover;
}
.mce-caret {
border-top-color: @ui-action-type-hover;
}
}
}


.mce-menu {
border-radius: 3px;
}

.mce-menu-item.mce-menu-item-normal.mce-stack-layout-item {
.mce-text, .mce-ico {
color: @ui-action-type;
}
&:hover {
background: @ui-action-hover;
.mce-text, .mce-ico {
color: @ui-action-type-hover;
}
}
}

.mce-menu-item.mce-menu-item-normal.mce-stack-layout-item.mce-active {
&, &:hover {
background: @gray-9;
}
.mce-text, .mce-ico {
color: @ui-action-type-hover;
}
}

.umb-grid .umb-rte {
border: 1px solid #d8d7d9;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div ng-controller="Umbraco.PropertyEditors.Grid.RichTextEditorController as vm">
<div ng-controller="Umbraco.PropertyEditors.Grid.RichTextEditorController as vm" class="umb-rte">

<grid-rte
configuration="model.config.rte"
Expand Down
8 changes: 6 additions & 2 deletions src/Umbraco.Web/Editors/ExamineManagementController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,12 @@ private ExamineIndexModel CreateModel(IIndex index)
var indexName = index.Name;

if (!(index is IIndexDiagnostics indexDiag))
indexDiag = new GenericIndexDiagnostics(index);

{
if (index is LuceneIndex luceneIndex)
indexDiag = new LuceneIndexDiagnostics(luceneIndex, Logger);
else
indexDiag = new GenericIndexDiagnostics(index);
}

var isHealth = indexDiag.IsHealthy();
var properties = new Dictionary<string, object>
Expand Down

0 comments on commit 99d2bef

Please sign in to comment.