Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

Commit

Permalink
Merge branch 'release/1.0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
johangit committed Mar 4, 2018
2 parents a038b63 + 0211815 commit 6937dd1
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 121 deletions.
7 changes: 7 additions & 0 deletions public/admin/ckeditor/ckeditor_preview.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,11 @@ blockquote {
display: block;
padding: 2px 10px;
border-left: solid #ccc 4px;
}

.html-code
{
font-family: monospace;
padding: 10px;
background-color: #e8e8e8;
}
2 changes: 1 addition & 1 deletion public/admin/ckeditor/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ CKEDITOR.editorConfig = function (config) {
// {name: 'basicstyles', items: ['RemoveFormat', '-', 'Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript']},
// {name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyCenter']},
// {name: 'styles', items: ['Format', 'Blockquote']},
// // {name: 'additional', items: ['ZooAdditionalContent']},
// // {name: 'additional', items: ['MyWidget']},
// ];
// config.toolbar = 'Base';

Expand Down
232 changes: 116 additions & 116 deletions public/admin/ckeditor/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,122 +16,122 @@
// For more information refer to: http://docs.ckeditor.com/#!/guide/dev_styles-section-style-rules

CKEDITOR.stylesSet.add( 'default', [
/* Block styles */

// These styles are already available in the "Format" drop-down list ("format" plugin),
// so they are not needed here by default. You may enable them to avoid
// placing the "Format" combo in the toolbar, maintaining the same features.
/*
{ name: 'Paragraph', element: 'p' },
{ name: 'Heading 1', element: 'h1' },
{ name: 'Heading 2', element: 'h2' },
{ name: 'Heading 3', element: 'h3' },
{ name: 'Heading 4', element: 'h4' },
{ name: 'Heading 5', element: 'h5' },
{ name: 'Heading 6', element: 'h6' },
{ name: 'Preformatted Text',element: 'pre' },
{ name: 'Address', element: 'address' },
*/

{ name: 'Italic Title', element: 'h2', styles: { 'font-style': 'italic' } },
{ name: 'Subtitle', element: 'h3', styles: { 'color': '#aaa', 'font-style': 'italic' } },
{
name: 'Special Container',
element: 'div',
styles: {
padding: '5px 10px',
background: '#eee',
border: '1px solid #ccc'
}
},

/* Inline styles */

// These are core styles available as toolbar buttons. You may opt enabling
// some of them in the Styles drop-down list, removing them from the toolbar.
// (This requires the "stylescombo" plugin.)
/*
{ name: 'Strong', element: 'strong', overrides: 'b' },
{ name: 'Emphasis', element: 'em' , overrides: 'i' },
{ name: 'Underline', element: 'u' },
{ name: 'Strikethrough', element: 'strike' },
{ name: 'Subscript', element: 'sub' },
{ name: 'Superscript', element: 'sup' },
*/

{ name: 'Marker', element: 'span', attributes: { 'class': 'marker' } },

{ name: 'Big', element: 'big' },
{ name: 'Small', element: 'small' },
{ name: 'Typewriter', element: 'tt' },

{ name: 'Computer Code', element: 'code' },
{ name: 'Keyboard Phrase', element: 'kbd' },
{ name: 'Sample Text', element: 'samp' },
{ name: 'Variable', element: 'var' },

{ name: 'Deleted Text', element: 'del' },
{ name: 'Inserted Text', element: 'ins' },

{ name: 'Cited Work', element: 'cite' },
{ name: 'Inline Quotation', element: 'q' },

{ name: 'Language: RTL', element: 'span', attributes: { 'dir': 'rtl' } },
{ name: 'Language: LTR', element: 'span', attributes: { 'dir': 'ltr' } },

/* Object styles */

{
name: 'Styled Image (left)',
element: 'img',
attributes: { 'class': 'left' }
},

{
name: 'Styled Image (right)',
element: 'img',
attributes: { 'class': 'right' }
},

{
name: 'Compact Table',
element: 'table',
attributes: {
cellpadding: '5',
cellspacing: '0',
border: '1',
bordercolor: '#ccc'
},
styles: {
'border-collapse': 'collapse'
}
},

{ name: 'Borderless Table', element: 'table', styles: { 'border-style': 'hidden', 'background-color': '#E6E6FA' } },
{ name: 'Square Bulleted List', element: 'ul', styles: { 'list-style-type': 'square' } },

/* Widget styles */

{ name: 'Clean Image', type: 'widget', widget: 'image', attributes: { 'class': 'image-clean' } },
{ name: 'Grayscale Image', type: 'widget', widget: 'image', attributes: { 'class': 'image-grayscale' } },

{ name: 'Featured Snippet', type: 'widget', widget: 'codeSnippet', attributes: { 'class': 'code-featured' } },

{ name: 'Featured Formula', type: 'widget', widget: 'mathjax', attributes: { 'class': 'math-featured' } },

{ name: '240p', type: 'widget', widget: 'embedSemantic', attributes: { 'class': 'embed-240p' }, group: 'size' },
{ name: '360p', type: 'widget', widget: 'embedSemantic', attributes: { 'class': 'embed-360p' }, group: 'size' },
{ name: '480p', type: 'widget', widget: 'embedSemantic', attributes: { 'class': 'embed-480p' }, group: 'size' },
{ name: '720p', type: 'widget', widget: 'embedSemantic', attributes: { 'class': 'embed-720p' }, group: 'size' },
{ name: '1080p', type: 'widget', widget: 'embedSemantic', attributes: { 'class': 'embed-1080p' }, group: 'size' },

// Adding space after the style name is an intended workaround. For now, there
// is no option to create two styles with the same name for different widget types. See http://dev.ckeditor.com/ticket/16664.
{ name: '240p ', type: 'widget', widget: 'embed', attributes: { 'class': 'embed-240p' }, group: 'size' },
{ name: '360p ', type: 'widget', widget: 'embed', attributes: { 'class': 'embed-360p' }, group: 'size' },
{ name: '480p ', type: 'widget', widget: 'embed', attributes: { 'class': 'embed-480p' }, group: 'size' },
{ name: '720p ', type: 'widget', widget: 'embed', attributes: { 'class': 'embed-720p' }, group: 'size' },
{ name: '1080p ', type: 'widget', widget: 'embed', attributes: { 'class': 'embed-1080p' }, group: 'size' }
/* Block styles */

// These styles are already available in the "Format" drop-down list ("format" plugin),
// so they are not needed here by default. You may enable them to avoid
// placing the "Format" combo in the toolbar, maintaining the same features.
{ name: 'Paragraph', element: 'p' },
/*
{ name: 'Heading 1', element: 'h1' },
{ name: 'Heading 2', element: 'h2' },
{ name: 'Heading 3', element: 'h3' },
{ name: 'Heading 4', element: 'h4' },
{ name: 'Heading 5', element: 'h5' },
{ name: 'Heading 6', element: 'h6' },
{ name: 'Preformatted Text',element: 'pre' },
{ name: 'Address', element: 'address' },
*/

// { name: 'Italic Title', element: 'h2', styles: { 'font-style': 'italic' } },
// { name: 'Subtitle', element: 'h3', styles: { 'color': '#aaa', 'font-style': 'italic' } },
// {
// name: 'Special Container',
// element: 'div',
// styles: {
// padding: '5px 10px',
// background: '#eee',
// border: '1px solid #ccc'
// }
// },

/* Inline styles */

// These are core styles available as toolbar buttons. You may opt enabling
// some of them in the Styles drop-down list, removing them from the toolbar.
// (This requires the "stylescombo" plugin.)
/*
{ name: 'Strong', element: 'strong', overrides: 'b' },
{ name: 'Emphasis', element: 'em' , overrides: 'i' },
{ name: 'Underline', element: 'u' },
{ name: 'Strikethrough', element: 'strike' },
{ name: 'Subscript', element: 'sub' },
{ name: 'Superscript', element: 'sup' },
*/

{ name: 'HTML Code', element: 'div', attributes: { 'class': 'html-code' } },

// { name: 'Big', element: 'big' },
// { name: 'Small', element: 'small' },
// { name: 'Typewriter', element: 'tt' },
//
// { name: 'Computer Code', element: 'code' },
// { name: 'Keyboard Phrase', element: 'kbd' },
// { name: 'Sample Text', element: 'samp' },
// { name: 'Variable', element: 'var' },
//
// { name: 'Deleted Text', element: 'del' },
// { name: 'Inserted Text', element: 'ins' },
//
// { name: 'Cited Work', element: 'cite' },
// { name: 'Inline Quotation', element: 'q' },
//
// { name: 'Language: RTL', element: 'span', attributes: { 'dir': 'rtl' } },
// { name: 'Language: LTR', element: 'span', attributes: { 'dir': 'ltr' } },

/* Object styles */

// {
// name: 'Styled Image (left)',
// element: 'img',
// attributes: { 'class': 'left' }
// },
//
// {
// name: 'Styled Image (right)',
// element: 'img',
// attributes: { 'class': 'right' }
// },
//
// {
// name: 'Compact Table',
// element: 'table',
// attributes: {
// cellpadding: '5',
// cellspacing: '0',
// border: '1',
// bordercolor: '#ccc'
// },
// styles: {
// 'border-collapse': 'collapse'
// }
// },
//
// { name: 'Borderless Table', element: 'table', styles: { 'border-style': 'hidden', 'background-color': '#E6E6FA' } },
// { name: 'Square Bulleted List', element: 'ul', styles: { 'list-style-type': 'square' } },

/* Widget styles */

// { name: 'Clean Image', type: 'widget', widget: 'image', attributes: { 'class': 'image-clean' } },
// { name: 'Grayscale Image', type: 'widget', widget: 'image', attributes: { 'class': 'image-grayscale' } },
//
// { name: 'Featured Snippet', type: 'widget', widget: 'codeSnippet', attributes: { 'class': 'code-featured' } },
//
// { name: 'Featured Formula', type: 'widget', widget: 'mathjax', attributes: { 'class': 'math-featured' } },
//
// { name: '240p', type: 'widget', widget: 'embedSemantic', attributes: { 'class': 'embed-240p' }, group: 'size' },
// { name: '360p', type: 'widget', widget: 'embedSemantic', attributes: { 'class': 'embed-360p' }, group: 'size' },
// { name: '480p', type: 'widget', widget: 'embedSemantic', attributes: { 'class': 'embed-480p' }, group: 'size' },
// { name: '720p', type: 'widget', widget: 'embedSemantic', attributes: { 'class': 'embed-720p' }, group: 'size' },
// { name: '1080p', type: 'widget', widget: 'embedSemantic', attributes: { 'class': 'embed-1080p' }, group: 'size' },

// Adding space after the style name is an intended workaround. For now, there
// is no option to create two styles with the same name for different widget types. See http://dev.ckeditor.com/ticket/16664.
// { name: '240p ', type: 'widget', widget: 'embed', attributes: { 'class': 'embed-240p' }, group: 'size' },
// { name: '360p ', type: 'widget', widget: 'embed', attributes: { 'class': 'embed-360p' }, group: 'size' },
// { name: '480p ', type: 'widget', widget: 'embed', attributes: { 'class': 'embed-480p' }, group: 'size' },
// { name: '720p ', type: 'widget', widget: 'embed', attributes: { 'class': 'embed-720p' }, group: 'size' },
// { name: '1080p ', type: 'widget', widget: 'embed', attributes: { 'class': 'embed-1080p' }, group: 'size' }

] );

10 changes: 9 additions & 1 deletion public/admin/crud/texteditor/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,20 @@ $(function () {


$(".js-texteditor").each(function () {
CKEDITOR.replace(this, {
var editor = CKEDITOR.replace(this, {
filebrowserImageBrowseUrl: adminUrl + '/elfinder/ckeditor',
// filebrowserImageUploadUrl: adminUrl + '/elfinder/connector?_token=' + token + "&cmd=upload&target=l1_Lw",
// filebrowserBrowseUrl: adminUrl + '/elfinder/ckeditor',
// filebrowserUploadUrl: adminUrl + '/elfinder/ckeditor'
});

editor.on('instanceReady', function (evt) {
try {
var textEditorVaule = window.ckeditorInitValues[$(this).attr("name")];
evt.editor.insertHtml(textEditorVaule);
} catch (e) {
}
});
});

// config.filebrowserBrowseUrl = '/elfinder/ckeditor';
Expand Down
14 changes: 11 additions & 3 deletions views/vendor/backpack/crud/fields/texteditor.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
class="js-texteditor"
name="{{ $field['name'] }}"
@include('crud::inc.field_attributes')

>{{ old($field['name']) ? old($field['name']) : (isset($field['value']) ? $field['value'] : (isset($field['default']) ? $field['default'] : '' )) }}</textarea>
></textarea>

{{-- HINT --}}
@if (isset($field['hint']))
Expand All @@ -15,12 +14,21 @@ class="js-texteditor"
</div>


<?php
$textEditorValue = old($field['name']) ? old($field['name']) : (isset($field['value']) ? $field['value'] : (isset($field['default']) ? $field['default'] : ''));
$textEditorValue = str_replace(["\n", "\r"], "", $textEditorValue);
$textEditorValue = str_replace('"', '\"', $textEditorValue);
?>
<script type="text/javascript">
window.ckeditorInitValues = window.ckeditorInitValues || {};
window.ckeditorInitValues["{{ $field['name'] }}"] = "<?php echo($textEditorValue) ?>";
</script>

@if ($crud->checkIfFieldIsFirstOfItsType($field, $fields))
@push('crud_fields_styles')
<link href="/admin/crud/texteditor/widget.css" rel="stylesheet"/>
@endpush


@push('crud_fields_scripts')
<script src="/admin/ckeditor/ckeditor.js"></script>
<script src="/admin/crud/texteditor/widget.js"></script>
Expand Down

0 comments on commit 6937dd1

Please sign in to comment.