DmitrMakeev commited on
Commit
b65f8a1
·
verified ·
1 Parent(s): 8f5a8c5

Update pages.html

Browse files
Files changed (1) hide show
  1. pages.html +479 -102
pages.html CHANGED
@@ -769,112 +769,489 @@ z-index: 1000; /* Убедитесь, что кнопка находится п
769
 
770
 
771
 
772
- <script type="text/javascript">
773
- var editor = grapesjs.init({
774
- container: '#gjs',
775
- fromElement: true,
776
- height: "100vh",
777
- storageManager: {
778
- type: 'local',
779
- autosave: true,
780
- autoload: true,
781
- stepsBeforeSave: 1,
782
- },
783
- plugins: [
784
- "gjs-blocks-basic",
785
- "grapesjs-component-countdown",
786
- "grapesjs-component-code-editor",
787
- "grapesjs-templates",
788
- "grapesjs-rte-extensions",
789
- "grapesjs-user-blocks",
790
- "grapesjs-tabs", // Плагин вкладок
791
- "grapesjs-tooltip", // Плагин подсказок
792
- "grapesjs-script-editor", // Плагин редактора скриптов
793
- "grapesjs-rulers" // Добавляем плагин линеек
794
- ],
795
- pluginsOpts: {
796
- "gjs-blocks-basic": {
797
- blocks: ['column1', 'column2', 'column3', 'column3-7', 'text', 'link', 'image', 'video', 'map'],
798
- blocksBasicOpts: {
799
- flexGrid: true,
800
- stylePrefix: 'gjs-',
801
- columns: 12,
802
- rowHeight: 75,
803
- addBasicStyle: true
804
- }
805
- },
806
- "grapesjs-component-code-editor": {
807
- panelId: 'views-container',
808
- appendTo: '.gjs-pn-views-container',
809
- openState: { pn: '35%', cv: '65%' },
810
- closedState: { pn: '15%', cv: '85%' },
811
- codeViewOptions: {},
812
- preserveWidth: false,
813
- clearData: false,
814
- editJs: true,
815
- cleanCssBtn: true,
816
- htmlBtnText: 'Применить',
817
- cssBtnText: 'Применить',
818
- cleanCssBtnText: 'Удалить'
819
- },
820
- "grapesjs-templates": {
821
- // Настройки для grapesjs-templates
822
- },
823
- "grapesjs-rte-extensions": {
824
- base: {
825
- bold: true,
826
- italic: true,
827
- underline: true,
828
- strikethrough: true,
829
- link: true,
830
  },
831
- fonts: {
832
- fontColor: true,
833
- hilite: true,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
834
  },
835
- format: {
836
- heading1: true,
837
- heading2: true,
838
- heading3: true,
839
- paragraph: true,
840
- clearFormatting: true,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
841
  },
842
- align: true,
843
- darkColorPicker: true,
844
- maxWidth: '600px'
845
- },
846
- "grapesjs-user-blocks": {
847
- // Настройки для grapesjs-user-blocks
848
- },
849
- "grapesjs-tabs": {
850
- // Настройки для grapesjs-tabs
851
- },
852
- "grapesjs-tooltip": {
853
- // Настройки для grapesjs-tooltip
854
- },
855
- "grapesjs-script-editor": {
856
- // Настройки для grapesjs-script-editor
857
- starter: 'let el = this',
858
- toolbarIcon: '<i class="fa fa-puzzle-piece"></i>',
859
- scriptTypesSupport: ['default', 'wrapper', 'text', 'textnode', 'video', 'image', 'svg'],
860
- toolbarBtnCustomScript: {},
861
- onRun: () => console.log('valid syntax'),
862
- onError: err => console.log('error:', err),
863
- modalTitle: 'Script',
864
- codeViewOptions: {},
865
- buttonLabel: 'save',
866
- commandAttachScript: {}
867
- },
868
- "grapesjs-rulers": {
869
- // Настройки для grapesjs-rulers
870
- dragMode: 'translate',
871
- rulerHeight: 15,
872
- canvasZoom: 94,
873
- rulerOpts: {}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
874
  }
875
- }
876
- });
877
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
878
 
879
 
880
  <script>
 
769
 
770
 
771
 
772
+ <script type="text/javascript">
773
+ var lp = './img/';
774
+ var plp = 'https://via.placeholder.com/350x250/';
775
+ var images = [
776
+ lp + 'team1.jpg',
777
+ lp + 'team2.jpg',
778
+ lp + 'team3.jpg',
779
+ plp + '78c5d6/fff',
780
+ plp + '459ba8/fff',
781
+ plp + '79c267/fff',
782
+ plp + 'c5d647/fff',
783
+ plp + 'f28c33/fff',
784
+ plp + 'e868a2/fff',
785
+ plp + 'cc4360/fff',
786
+ lp + 'work-desk.jpg',
787
+ lp + 'phone-app.png',
788
+ lp + 'bg-gr-v.png'
789
+ ];
790
+
791
+ var editor = grapesjs.init({
792
+ height: '100%',
793
+ container : '#gjs',
794
+ fromElement: true,
795
+ showOffsets: true,
796
+ assetManager: {
797
+ embedAsBase64: true,
798
+ assets: images
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
799
  },
800
+ selectorManager: { componentFirst: true },
801
+ styleManager: {
802
+ sectors: [{
803
+ name: 'General',
804
+ properties:[
805
+ {
806
+ extend: 'float',
807
+ type: 'radio',
808
+ default: 'none',
809
+ options: [
810
+ { value: 'none', className: 'fa fa-times'},
811
+ { value: 'left', className: 'fa fa-align-left'},
812
+ { value: 'right', className: 'fa fa-align-right'}
813
+ ],
814
+ },
815
+ 'display',
816
+ { extend: 'position', type: 'select' },
817
+ 'top',
818
+ 'right',
819
+ 'left',
820
+ 'bottom',
821
+ ],
822
+ }, {
823
+ name: 'Dimension',
824
+ open: false,
825
+ properties: [
826
+ 'width',
827
+ {
828
+ id: 'flex-width',
829
+ type: 'integer',
830
+ name: 'Width',
831
+ units: ['px', '%'],
832
+ property: 'flex-basis',
833
+ toRequire: 1,
834
+ },
835
+ 'height',
836
+ 'max-width',
837
+ 'min-height',
838
+ 'margin',
839
+ 'padding'
840
+ ],
841
+ },{
842
+ name: 'Typography',
843
+ open: false,
844
+ properties: [
845
+ 'font-family',
846
+ 'font-size',
847
+ 'font-weight',
848
+ 'letter-spacing',
849
+ 'color',
850
+ 'line-height',
851
+ {
852
+ extend: 'text-align',
853
+ options: [
854
+ { id : 'left', label : 'Left', className: 'fa fa-align-left'},
855
+ { id : 'center', label : 'Center', className: 'fa fa-align-center' },
856
+ { id : 'right', label : 'Right', className: 'fa fa-align-right'},
857
+ { id : 'justify', label : 'Justify', className: 'fa fa-align-justify'}
858
+ ],
859
+ },
860
+ {
861
+ property: 'text-decoration',
862
+ type: 'radio',
863
+ default: 'none',
864
+ options: [
865
+ { id: 'none', label: 'None', className: 'fa fa-times'},
866
+ { id: 'underline', label: 'underline', className: 'fa fa-underline' },
867
+ { id: 'line-through', label: 'Line-through', className: 'fa fa-strikethrough'}
868
+ ],
869
+ },
870
+ 'text-shadow'
871
+ ],
872
+ },{
873
+ name: 'Decorations',
874
+ open: false,
875
+ properties: [
876
+ 'opacity',
877
+ 'border-radius',
878
+ 'border',
879
+ 'box-shadow',
880
+ 'background', // { id: 'background-bg', property: 'background', type: 'bg' }
881
+ ],
882
+ },{
883
+ name: 'Extra',
884
+ open: false,
885
+ buildProps: [
886
+ 'transition',
887
+ 'perspective',
888
+ 'transform'
889
+ ],
890
+ },{
891
+ name: 'Flex',
892
+ open: false,
893
+ properties: [{
894
+ name: 'Flex Container',
895
+ property: 'display',
896
+ type: 'select',
897
+ defaults: 'block',
898
+ list: [
899
+ { value: 'block', name: 'Disable'},
900
+ { value: 'flex', name: 'Enable'}
901
+ ],
902
+ },{
903
+ name: 'Flex Parent',
904
+ property: 'label-parent-flex',
905
+ type: 'integer',
906
+ },{
907
+ name: 'Direction',
908
+ property: 'flex-direction',
909
+ type: 'radio',
910
+ defaults: 'row',
911
+ list: [{
912
+ value: 'row',
913
+ name: 'Row',
914
+ className: 'icons-flex icon-dir-row',
915
+ title: 'Row',
916
+ },{
917
+ value: 'row-reverse',
918
+ name: 'Row reverse',
919
+ className: 'icons-flex icon-dir-row-rev',
920
+ title: 'Row reverse',
921
+ },{
922
+ value: 'column',
923
+ name: 'Column',
924
+ title: 'Column',
925
+ className: 'icons-flex icon-dir-col',
926
+ },{
927
+ value: 'column-reverse',
928
+ name: 'Column reverse',
929
+ title: 'Column reverse',
930
+ className: 'icons-flex icon-dir-col-rev',
931
+ }],
932
+ },{
933
+ name: 'Justify',
934
+ property: 'justify-content',
935
+ type: 'radio',
936
+ defaults: 'flex-start',
937
+ list: [{
938
+ value: 'flex-start',
939
+ className: 'icons-flex icon-just-start',
940
+ title: 'Start',
941
+ },{
942
+ value: 'flex-end',
943
+ title: 'End',
944
+ className: 'icons-flex icon-just-end',
945
+ },{
946
+ value: 'space-between',
947
+ title: 'Space between',
948
+ className: 'icons-flex icon-just-sp-bet',
949
+ },{
950
+ value: 'space-around',
951
+ title: 'Space around',
952
+ className: 'icons-flex icon-just-sp-ar',
953
+ },{
954
+ value: 'center',
955
+ title: 'Center',
956
+ className: 'icons-flex icon-just-sp-cent',
957
+ }],
958
+ },{
959
+ name: 'Align',
960
+ property: 'align-items',
961
+ type: 'radio',
962
+ defaults: 'center',
963
+ list: [{
964
+ value: 'flex-start',
965
+ title: 'Start',
966
+ className: 'icons-flex icon-al-start',
967
+ },{
968
+ value: 'flex-end',
969
+ title: 'End',
970
+ className: 'icons-flex icon-al-end',
971
+ },{
972
+ value: 'stretch',
973
+ title: 'Stretch',
974
+ className: 'icons-flex icon-al-str',
975
+ },{
976
+ value: 'center',
977
+ title: 'Center',
978
+ className: 'icons-flex icon-al-center',
979
+ }],
980
+ },{
981
+ name: 'Flex Children',
982
+ property: 'label-parent-flex',
983
+ type: 'integer',
984
+ },{
985
+ name: 'Order',
986
+ property: 'order',
987
+ type: 'integer',
988
+ defaults: 0,
989
+ min: 0
990
+ },{
991
+ name: 'Flex',
992
+ property: 'flex',
993
+ type: 'composite',
994
+ properties : [{
995
+ name: 'Grow',
996
+ property: 'flex-grow',
997
+ type: 'integer',
998
+ defaults: 0,
999
+ min: 0
1000
+ },{
1001
+ name: 'Shrink',
1002
+ property: 'flex-shrink',
1003
+ type: 'integer',
1004
+ defaults: 0,
1005
+ min: 0
1006
+ },{
1007
+ name: 'Basis',
1008
+ property: 'flex-basis',
1009
+ type: 'integer',
1010
+ units: ['px','%',''],
1011
+ unit: '',
1012
+ defaults: 'auto',
1013
+ }],
1014
+ },{
1015
+ name: 'Align',
1016
+ property: 'align-self',
1017
+ type: 'radio',
1018
+ defaults: 'auto',
1019
+ list: [{
1020
+ value: 'auto',
1021
+ name: 'Auto',
1022
+ },{
1023
+ value: 'flex-start',
1024
+ title: 'Start',
1025
+ className: 'icons-flex icon-al-start',
1026
+ },{
1027
+ value : 'flex-end',
1028
+ title: 'End',
1029
+ className: 'icons-flex icon-al-end',
1030
+ },{
1031
+ value : 'stretch',
1032
+ title: 'Stretch',
1033
+ className: 'icons-flex icon-al-str',
1034
+ },{
1035
+ value : 'center',
1036
+ title: 'Center',
1037
+ className: 'icons-flex icon-al-center',
1038
+ }],
1039
+ }]
1040
+ }
1041
+ ],
1042
  },
1043
+ plugins: [
1044
+ 'gjs-blocks-basic',
1045
+ 'grapesjs-plugin-forms',
1046
+ 'grapesjs-component-countdown',
1047
+ 'grapesjs-plugin-export',
1048
+ 'grapesjs-tabs',
1049
+ 'grapesjs-custom-code',
1050
+ 'grapesjs-touch',
1051
+ 'grapesjs-parser-postcss',
1052
+ 'grapesjs-tooltip',
1053
+ 'grapesjs-tui-image-editor',
1054
+ 'grapesjs-typed',
1055
+ 'grapesjs-style-bg',
1056
+ 'grapesjs-preset-webpage',
1057
+ ],
1058
+ pluginsOpts: {
1059
+ 'gjs-blocks-basic': { flexGrid: true },
1060
+ 'grapesjs-tui-image-editor': {
1061
+ script: [
1062
+ // 'https://cdnjs.cloudflare.com/ajax/libs/fabric.js/1.6.7/fabric.min.js',
1063
+ 'https://uicdn.toast.com/tui.code-snippet/v1.5.2/tui-code-snippet.min.js',
1064
+ 'https://uicdn.toast.com/tui-color-picker/v2.2.7/tui-color-picker.min.js',
1065
+ 'https://uicdn.toast.com/tui-image-editor/v3.15.2/tui-image-editor.min.js'
1066
+ ],
1067
+ style: [
1068
+ 'https://uicdn.toast.com/tui-color-picker/v2.2.7/tui-color-picker.min.css',
1069
+ 'https://uicdn.toast.com/tui-image-editor/v3.15.2/tui-image-editor.min.css',
1070
+ ],
1071
+ },
1072
+ 'grapesjs-tabs': {
1073
+ tabsBlock: { category: 'Extra' }
1074
+ },
1075
+ 'grapesjs-typed': {
1076
+ block: {
1077
+ category: 'Extra',
1078
+ content: {
1079
+ type: 'typed',
1080
+ 'type-speed': 40,
1081
+ strings: [
1082
+ 'Text row one',
1083
+ 'Text row two',
1084
+ 'Text row three',
1085
+ ],
1086
+ }
1087
+ }
1088
+ },
1089
+ 'grapesjs-preset-webpage': {
1090
+ modalImportTitle: 'Import Template',
1091
+ modalImportLabel: '<div style="margin-bottom: 10px; font-size: 13px;">Paste here your HTML/CSS and click Import</div>',
1092
+ modalImportContent: function(editor) {
1093
+ return editor.getHtml() + '<style>'+editor.getCss()+'</style>'
1094
+ },
1095
+ },
1096
  },
1097
+ });
1098
+
1099
+ editor.I18n.addMessages({
1100
+ en: {
1101
+ styleManager: {
1102
+ properties: {
1103
+ 'background-repeat': 'Repeat',
1104
+ 'background-position': 'Position',
1105
+ 'background-attachment': 'Attachment',
1106
+ 'background-size': 'Size',
1107
+ }
1108
+ },
1109
+ }
1110
+ });
1111
+
1112
+ var pn = editor.Panels;
1113
+ var modal = editor.Modal;
1114
+ var cmdm = editor.Commands;
1115
+
1116
+ // Update canvas-clear command
1117
+ cmdm.add('canvas-clear', function() {
1118
+ if(confirm('Are you sure to clean the canvas?')) {
1119
+ editor.runCommand('core:canvas-clear')
1120
+ setTimeout(function(){ localStorage.clear()}, 0)
1121
+ }
1122
+ });
1123
+
1124
+ // Add info command
1125
+ var mdlClass = 'gjs-mdl-dialog-sm';
1126
+ var infoContainer = document.getElementById('info-panel');
1127
+
1128
+ cmdm.add('open-info', function() {
1129
+ var mdlDialog = document.querySelector('.gjs-mdl-dialog');
1130
+ mdlDialog.className += ' ' + mdlClass;
1131
+ infoContainer.style.display = 'block';
1132
+ modal.setTitle('About this demo');
1133
+ modal.setContent(infoContainer);
1134
+ modal.open();
1135
+ modal.getModel().once('change:open', function() {
1136
+ mdlDialog.className = mdlDialog.className.replace(mdlClass, '');
1137
+ })
1138
+ });
1139
+
1140
+ pn.addButton('options', {
1141
+ id: 'open-info',
1142
+ className: 'fa fa-question-circle',
1143
+ command: function() { editor.runCommand('open-info') },
1144
+ attributes: {
1145
+ 'title': 'About',
1146
+ 'data-tooltip-pos': 'bottom',
1147
+ },
1148
+ });
1149
+
1150
+
1151
+ // Simple warn notifier
1152
+ var origWarn = console.warn;
1153
+ toastr.options = {
1154
+ closeButton: true,
1155
+ preventDuplicates: true,
1156
+ showDuration: 250,
1157
+ hideDuration: 150
1158
+ };
1159
+ console.warn = function (msg) {
1160
+ if (msg.indexOf('[undefined]') == -1) {
1161
+ toastr.warning(msg);
1162
+ }
1163
+ origWarn(msg);
1164
+ };
1165
+
1166
+
1167
+ // Add and beautify tooltips
1168
+ [['sw-visibility', 'Show Borders'], ['preview', 'Preview'], ['fullscreen', 'Fullscreen'],
1169
+ ['export-template', 'Export'], ['undo', 'Undo'], ['redo', 'Redo'],
1170
+ ['gjs-open-import-webpage', 'Import'], ['canvas-clear', 'Clear canvas']]
1171
+ .forEach(function(item) {
1172
+ pn.getButton('options', item[0]).set('attributes', {title: item[1], 'data-tooltip-pos': 'bottom'});
1173
+ });
1174
+ [['open-sm', 'Style Manager'], ['open-layers', 'Layers'], ['open-blocks', 'Blocks']]
1175
+ .forEach(function(item) {
1176
+ pn.getButton('views', item[0]).set('attributes', {title: item[1], 'data-tooltip-pos': 'bottom'});
1177
+ });
1178
+ var titles = document.querySelectorAll('*[title]');
1179
+
1180
+ for (var i = 0; i < titles.length; i++) {
1181
+ var el = titles[i];
1182
+ var title = el.getAttribute('title');
1183
+ title = title ? title.trim(): '';
1184
+ if(!title)
1185
+ break;
1186
+ el.setAttribute('data-tooltip', title);
1187
+ el.setAttribute('title', '');
1188
  }
1189
+
1190
+
1191
+ // Store and load events
1192
+ editor.on('storage:load', function(e) { console.log('Loaded ', e) });
1193
+ editor.on('storage:store', function(e) { console.log('Stored ', e) });
1194
+
1195
+
1196
+ // Do stuff on load
1197
+ editor.on('load', function() {
1198
+ var $ = grapesjs.$;
1199
+
1200
+ // Show borders by default
1201
+ pn.getButton('options', 'sw-visibility').set({
1202
+ command: 'core:component-outline',
1203
+ 'active': true,
1204
+ });
1205
+
1206
+ // Show logo with the version
1207
+ var logoCont = document.querySelector('.gjs-logo-cont');
1208
+ document.querySelector('.gjs-logo-version').innerHTML = 'v' + grapesjs.version;
1209
+ var logoPanel = document.querySelector('.gjs-pn-commands');
1210
+ logoPanel.appendChild(logoCont);
1211
+
1212
+
1213
+ // Load and show settings and style manager
1214
+ var openTmBtn = pn.getButton('views', 'open-tm');
1215
+ openTmBtn && openTmBtn.set('active', 1);
1216
+ var openSm = pn.getButton('views', 'open-sm');
1217
+ openSm && openSm.set('active', 1);
1218
+
1219
+ // Remove trait view
1220
+ pn.removeButton('views', 'open-tm');
1221
+
1222
+ // Add Settings Sector
1223
+ var traitsSector = $('<div class="gjs-sm-sector no-select">'+
1224
+ '<div class="gjs-sm-sector-title"><span class="icon-settings fa fa-cog"></span> <span class="gjs-sm-sector-label">Settings</span></div>' +
1225
+ '<div class="gjs-sm-properties" style="display: none;"></div></div>');
1226
+ var traitsProps = traitsSector.find('.gjs-sm-properties');
1227
+ traitsProps.append($('.gjs-traits-cs'));
1228
+ $('.gjs-sm-sectors').before(traitsSector);
1229
+ traitsSector.find('.gjs-sm-sector-title').on('click', function(){
1230
+ var traitStyle = traitsProps.get(0).style;
1231
+ var hidden = traitStyle.display == 'none';
1232
+ if (hidden) {
1233
+ traitStyle.display = 'block';
1234
+ } else {
1235
+ traitStyle.display = 'none';
1236
+ }
1237
+ });
1238
+
1239
+ // Open block manager
1240
+ var openBlocksBtn = editor.Panels.getButton('views', 'open-blocks');
1241
+ openBlocksBtn && openBlocksBtn.set('active', 1);
1242
+
1243
+ // Move Ad
1244
+ $('#gjs').append($('.ad-cont'));
1245
+ });
1246
+
1247
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
1248
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
1249
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
1250
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
1251
+
1252
+ ga('create', 'UA-74284223-1', 'auto');
1253
+ ga('send', 'pageview');
1254
+ </script>
1255
 
1256
 
1257
  <script>