Merge pull request #194 from creative-commoners/pulls/2.0/fix-insert-document-toolbar

FIX Missing shortcode field and broken Javascript when inserting document
This commit is contained in:
Franco Springveldt 2017-08-07 13:34:21 +12:00 committed by GitHub
commit 16f0bef034
6 changed files with 37 additions and 24 deletions

View File

@ -54,8 +54,9 @@ class DMSDocumentAddExistingField extends CompositeField
public function Field($properties = array())
{
Requirements::javascript(DMS_DIR.'/javascript/DMSDocumentAddExistingField.js');
Requirements::javascript(DMS_DIR."/javascript/DocumentHtmlEditorFieldToolbar.js");
Requirements::javascript(DMS_DIR . '/javascript/DMSDocumentAddExistingField.js');
Requirements::javascript(DMS_DIR . '/javascript/DocumentHtmlEditorFieldToolbar.js');
Requirements::css(DMS_DIR . '/dist/css/cmsbundle.css');
return $this->renderWith('DMSDocumentAddExistingField');
}

View File

@ -26,6 +26,8 @@ class DocumentHtmlEditorFieldToolbar extends Extension
$addExistingField->setUseFieldClass(false);
$fieldList->insertAfter($addExistingField, 'Description');
$fieldList->push(HiddenField::create('DMSShortcodeHandlerKey', false, DMS::inst()->getShortcodeHandlerKey()));
// Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js");
// Requirements::javascript(SAPPHIRE_DIR . "/javascript/tiny_mce_improvements.js");
//

View File

@ -172,13 +172,13 @@ form.small .field .TreeDropdownField,
.ss-add .document-add-existing .treedropdownfield-toggle-panel-link {
padding: 5px 9px 9px;
background: #fff;
border: 1px solid #B3B3B3;
border: 1px solid #b3b3b3;
float: right;
z-index: 99999;
position: relative; }
.ss-add .document-add-existing .treedropdownfield-toggle-panel-link.treedropdownfield-open-tree {
background: #fff;
border: 1px solid #B3B3B3;
border: 1px solid #b3b3b3;
border-bottom: none;
border-bottom-right-radius: 0; }
@ -228,16 +228,18 @@ form.small .field .TreeDropdownField,
font-weight: bold;
text-shadow: 1px 1px 0 white; }
.ss-add .document-add-existing.link-editor-context .middleColumn {
margin-left: 184px; }
.ss-add .document-add-existing.link-editor-context .middleColumn input {
background: white;
border: 1px solid #B3B3B3;
line-height: 16px;
margin: 0;
border-radius: 4px;
background-size: 100%;
max-width: 512px; }
.ss-add .document-add-existing.link-editor-context .middleColumn input {
background: white;
border: 1px solid #b3b3b3;
line-height: 16px;
border-radius: 4px;
background-size: 100%;
max-width: 468px; }
.ss-add .document-add-existing.link-editor-context .middleColumn input.document-autocomplete {
max-width: 365px; }
.ss-add .document-add-existing.link-editor-context .document-list {
width: calc(100% - 2px); }
.ss-add .ss-assetuploadfield.link-editor-context label {
float: left;
@ -314,7 +316,7 @@ form.small .field .TreeDropdownField,
margin-top: 13px;
padding: 10px;
background: white;
border: 1px solid #B3B3B3; }
border: 1px solid #b3b3b3; }
#Form_ItemEditForm ul.SelectionGroup li.selected label.ui-button:after {
top: 43px; }
#Form_ItemEditForm ul.SelectionGroup .treedropdownfield-panel {

View File

@ -92,7 +92,7 @@
}
// Match a document or call the regular link handling
if (href.match(new RegExp("/^\[" + this.getShortcodeKey() + "(\s*|%20|,)?id=([0-9]+)\]?$/", "i"))) {
if (href.match(new RegExp('^\\[' + this.getShortcodeKey() + '(\s*|%20|,)?id=([0-9]+)\\]?$', 'i'))) {
var returnArray = {
LinkType: 'document',
DocumentID: RegExp.$2,

View File

@ -8,3 +8,5 @@ $color-grey-lighter: #f8f8f8 !default;
$color-grey-light: #d0d3d5 !default;
$color-grey-dark: #66727d !default;
$color-white: #ffffff !default;
$color-cms-input-border: #b3b3b3 !default;

View File

@ -37,14 +37,14 @@
.treedropdownfield-toggle-panel-link {
padding: 5px 9px 9px;
background: #fff;
border: 1px solid #B3B3B3;
border: 1px solid $color-cms-input-border;
float: right;
z-index: 99999;
position: relative;
&.treedropdownfield-open-tree {
background: #fff;
border: 1px solid #B3B3B3;
border: 1px solid $color-cms-input-border;
border-bottom:none;
border-bottom-right-radius:0;
}
@ -100,6 +100,7 @@
}
}
// When inserting a link to a document via the TinyMCE editor
&.link-editor-context {
label {
float: left;
@ -112,18 +113,23 @@
}
.middleColumn {
margin-left: 184px;
input {
background: white;
border: 1px solid #B3B3B3;
border: 1px solid $color-cms-input-border;
line-height: 16px;
margin: 0;
border-radius: 4px;
background-size: 100%;
max-width: 512px;
max-width: 468px;
&.document-autocomplete {
max-width: 365px;
}
}
}
.document-list {
width: calc(100% - 2px);
}
}
}
@ -234,7 +240,7 @@
margin-top: 13px;
padding: 10px;
background: white;
border: 1px solid #B3B3B3;
border: 1px solid $color-cms-input-border;
}
&.selected {