|
2 | 2 | <html ng-app="textPlugin"> |
3 | 3 | <head lang="en"> |
4 | 4 | <meta charset="UTF-8"> |
5 | | - |
6 | | - <!-- CSS --> |
7 | | - <link href="../../../../styles/helper.css" rel="stylesheet"> |
8 | | - <link href="../../../../styles/siteIcons.css" rel="stylesheet"> |
9 | | - |
| 5 | + |
10 | 6 | <!-- JS --> |
11 | 7 | <script src="../../../../scripts/buildfire.js"></script> |
12 | 8 | <script src="../../../../scripts/angular/angular.min.js"></script> |
13 | 9 | <script src="../../../../scripts/tinymce/tinymce.min.js"></script> |
14 | 10 | <script src="../../../../scripts/tinymce/ui-tinymce.js"></script> |
15 | | - |
| 11 | + <script src="../../../../scripts/buildfire/services/searchEngine/searchEngine.js"></script> |
| 12 | + |
16 | 13 | <script src="../../../../scripts/jquery/jquery-1.11.2.min.js"></script> |
17 | 14 | <script src="../../../../scripts/sortable.min.js"></script> |
18 | 15 | <script src="../../../../scripts/buildfire/components/carousel/carousel.js"></script> |
19 | | - |
| 16 | + |
| 17 | + <script src="./controlState.js"></script> |
| 18 | + <script src="../../widget/global/js/services/AuthManager.js"></script> |
| 19 | + <script src="../../widget/global/js/models/Setting.js"></script> |
| 20 | + <script src="../../widget/global/js/repositories/Settings.js"></script> |
| 21 | + <script src="../../widget/global/js/utils.js"></script> |
| 22 | + <script src="../../widget/global/js/services/searchEngine.js"></script> |
| 23 | + <script src="./index.js"></script> |
| 24 | + |
| 25 | + <!-- CSS --> |
| 26 | + <link href="../../../../styles/helper.css" rel="stylesheet"> |
| 27 | + <link href="../../../../styles/siteIcons.css" rel="stylesheet"> |
| 28 | + <link href="./style.css" rel="stylesheet"/> |
20 | 29 |
|
21 | 30 | </head> |
| 31 | + |
22 | 32 | <body ng-controller="textPluginCtrl" id="textApp"> |
23 | | - <div ng-form="frmMain"> |
24 | | - <div id="carousel"></div> |
25 | | - <hr class="none"> |
26 | | - <div class="item clearfix row"> |
27 | | - <div class="labels col-md-3 padding-right-zero pull-left"> |
28 | | - <span>Text</span> |
29 | | - </div> |
| 33 | +<div ng-form="frmMain" id="frMain" class="flex"> |
| 34 | + <div id="carousel"></div> |
| 35 | + <hr class="none"> |
| 36 | + <div class="item clearfix row"> |
| 37 | + <div class="labels col-md-3 padding-right-zero pull-left"> |
| 38 | + <span>Content</span> |
30 | 39 | </div> |
31 | | - <hr class="none"> |
32 | | - <div class="item clearfix row"> |
33 | | - <div class="main col-md-12 pull-left"> |
34 | | - <textarea id="text" ui-tinymce="editorOptions" class="form-control" rows="5" width="100%" ng-model="data.content.text"></textarea> |
35 | | - </div> |
| 40 | + </div> |
| 41 | + <hr class="none"> |
| 42 | + <div class="item clearfix row tinymce-editor"> |
| 43 | + <div class="main col-md-12 pull-left"> |
| 44 | + <textarea id="text" ui-tinymce="editorOptions" class="form-control" rows="5" width="100%" ng-model="data.content.text"></textarea> |
36 | 45 | </div> |
37 | 46 | </div> |
38 | | - |
39 | | - <script> |
40 | | - var textPluginApp = angular.module('textPlugin', [ 'ui.tinymce' ]); |
41 | | - |
42 | | - textPluginApp.controller('textPluginCtrl', ['$scope', function ($scope) { |
43 | | - var datastoreInitialized = false; |
44 | | - |
45 | | - $scope.editorOptions = { |
46 | | - plugins: 'advlist autolink link image lists charmap print preview', |
47 | | - skin: 'lightgray', |
48 | | - trusted: true, |
49 | | - theme: 'modern', |
50 | | - format: 'html', |
51 | | - convert_urls : false, |
52 | | - relative_urls : false |
53 | | - |
54 | | - }; |
55 | | - |
56 | | - $scope.data = { |
57 | | - content: { |
58 | | - carouselImages: [], |
59 | | - text: "<p> <br></p>" |
60 | | - }, |
61 | | - design: { |
62 | | - backgroundImage: null, |
63 | | - backgroundBlur: 0, |
64 | | - selectedLayout: 1 |
65 | | - } |
66 | | - }; |
67 | | - |
68 | | - // create a new instance of the buildfire carousel editor |
69 | | - var editor = new buildfire.components.carousel.editor("#carousel"); |
70 | | - |
71 | | - /* |
72 | | - * Go pull any previously saved data |
73 | | - * */ |
74 | | - buildfire.datastore.get(function (err, result) { |
75 | | - |
76 | | - if (!err) { |
77 | | - datastoreInitialized = true; |
78 | | - } else { |
79 | | - console.error("Error: ", err); |
80 | | - return; |
81 | | - } |
82 | | - |
83 | | - if (result && result.data && !angular.equals({}, result.data) && result.id) { |
84 | | - if(!result.data.design) result.data.design = $scope.data.design; |
85 | | - $scope.data = result.data; |
86 | | - $scope.id = result.id; |
87 | | - if($scope.data.content && $scope.data.content.carouselImages) |
88 | | - editor.loadItems($scope.data.content.carouselImages); |
89 | | - if (tmrDelay) clearTimeout(tmrDelay); |
90 | | - } else{ |
91 | | - $scope.data = { content :{ |
92 | | - text : |
93 | | - '<p>The WYSIWYG (which stands for What You See Is What You Get) allows you to do some really cool stuff. You can add images like this</p>\ |
94 | | - <p><img src="https://static.pexels.com/photos/12057/pexels-photo-12057-large.jpeg" alt="" width="100%" height="auto" /></p>\ |
95 | | - <p>You can even create links like these:<br /> Link to web content like <a href="http://www.google.com">this</a><br /> Link to a phone number like this <a href="tel: 8005551234">8005551234</a><br /> Link to an email like this <a href="mailto:noreply@google.com">noreply@google.com</a></p>\ |
96 | | - <p>Want to add some super cool videos about this item? You can do that too!</p>\ |
97 | | - <p><iframe src="https://www.youtube.com/embed/wTcNtgA6gHs" width="100%" height="auto" frameborder="0" allowfullscreen="allowfullscreen"></iframe></p>\ |
98 | | - <p>You can create bulleted and numbered lists like this:</p>\ |
99 | | - <ul>\ |
100 | | - <li>This is an item in a list</li>\ |
101 | | - <li>This is another item in a list</li>\ |
102 | | - <li>This is a last item in a list</li>\ |
103 | | - </ul>\ |
104 | | - <p>Want more info? Check out our tutorial by clicking the help button at the top of this page.</p>', |
105 | | - |
106 | | - carouselImages : |
107 | | - [{"action":"noAction","iconUrl":"http://imageserver.prod.s3.amazonaws.com/b55ee984-a8e8-11e5-88d3-124798dea82d/5db61d30-0854-11e6-8963-f5d737bc276b.jpg","title":"image 1"},{"action":"noAction","iconUrl":"http://imageserver.prod.s3.amazonaws.com/b55ee984-a8e8-11e5-88d3-124798dea82d/31c88a00-0854-11e6-8963-f5d737bc276b.jpeg","title":"image 2"}] |
108 | | - }, |
109 | | - design: { |
110 | | - backgroundImage: null, |
111 | | - backgroundBlur: 0, |
112 | | - selectedLayout: 1 |
113 | | - } |
114 | | - }; |
115 | | - editor.loadItems($scope.data.content.carouselImages); |
116 | | - } |
117 | | - |
118 | | - /* |
119 | | - * watch for changes in data and trigger the saveDataWithDelay function on change |
120 | | - * */ |
121 | | - $scope.$watch('data', saveDataWithDelay, true); |
122 | | - |
123 | | - if (!$scope.$$phase && !$scope.$root.$$phase) { |
124 | | - $scope.$apply(); |
125 | | - } |
126 | | - }); |
127 | | - |
128 | | - /* |
129 | | - * Call the datastore to save the data object |
130 | | - */ |
131 | | - var saveData = function (newObj) { |
132 | | - if (!datastoreInitialized) { |
133 | | - console.error("Error with datastore didn't get called"); |
134 | | - return; |
135 | | - } |
136 | | - if(newObj.content.text.indexOf("src=\"//")!=-1){ |
137 | | - newObj.content.text= newObj.content.text.replace("src=\"//","src=\"https://") |
138 | | - } |
139 | | - if (newObj == undefined) return; |
140 | | - |
141 | | - if ($scope.frmMain.$invalid) { |
142 | | - console.warn('invalid data, details will not be saved'); |
143 | | - return; |
144 | | - } |
145 | | - |
146 | | - if(!newObj.content || !newObj.design) |
147 | | - return; |
148 | | - |
149 | | - buildfire.datastore.save(newObj, function (err, result) { |
150 | | - if (err || !result) { |
151 | | - console.error('Error saving the widget details: ', err); |
152 | | - } |
153 | | - else { |
154 | | - console.info('Widget details saved'); |
155 | | - } |
156 | | - }); |
157 | | - }; |
158 | | - |
159 | | - /* |
160 | | - * create an artificial delay so api isnt called on every character entered |
161 | | - * */ |
162 | | - var tmrDelay = null; |
163 | | - var saveDataWithDelay = function (newObj, oldObj) { |
164 | | - if (tmrDelay) clearTimeout(tmrDelay); |
165 | | - if (angular.equals(newObj, oldObj)) return; |
166 | | - tmrDelay = setTimeout(function () { |
167 | | - saveData(newObj); |
168 | | - }, 500); |
169 | | - }; |
170 | | - |
171 | | - // this method will be called when a new item added to the list |
172 | | - editor.onAddItems = editor.onDeleteItem = editor.onItemChange = editor.onOrderChange = function () { |
173 | | - $scope.data.content.carouselImages = editor.items; |
174 | | - saveData($scope.data); |
175 | | - }; |
176 | | - |
177 | | - }]); |
178 | | - </script> |
| 47 | +</div> |
179 | 48 | </body> |
180 | 49 | </html> |
0 commit comments