Fixed double brace issues in both editors.
Double braces were being parsed by angular in both the WYSIWYG and markdown editor. Fixes #150 and fixes #155.
Showing
3 changed files
with
16 additions
and
6 deletions
| ... | @@ -252,11 +252,14 @@ module.exports = function (ngApp, events) { | ... | @@ -252,11 +252,14 @@ module.exports = function (ngApp, events) { |
| 252 | link: function (scope, element, attrs) { | 252 | link: function (scope, element, attrs) { |
| 253 | 253 | ||
| 254 | // Set initial model content | 254 | // Set initial model content |
| 255 | - var content = element.val(); | 255 | + element = element.find('textarea').first(); |
| 256 | + let content = element.val(); | ||
| 256 | scope.mdModel = content; | 257 | scope.mdModel = content; |
| 257 | scope.mdChange(markdown(content)); | 258 | scope.mdChange(markdown(content)); |
| 258 | 259 | ||
| 259 | - element.on('change input', (e) => { | 260 | + console.log('test'); |
| 261 | + | ||
| 262 | + element.on('change input', (event) => { | ||
| 260 | content = element.val(); | 263 | content = element.val(); |
| 261 | $timeout(() => { | 264 | $timeout(() => { |
| 262 | scope.mdModel = content; | 265 | scope.mdModel = content; |
| ... | @@ -284,7 +287,7 @@ module.exports = function (ngApp, events) { | ... | @@ -284,7 +287,7 @@ module.exports = function (ngApp, events) { |
| 284 | link: function (scope, element, attrs) { | 287 | link: function (scope, element, attrs) { |
| 285 | 288 | ||
| 286 | // Elements | 289 | // Elements |
| 287 | - const input = element.find('textarea[markdown-input]'); | 290 | + const input = element.find('[markdown-input] textarea').first(); |
| 288 | const display = element.find('.markdown-display').first(); | 291 | const display = element.find('.markdown-display').first(); |
| 289 | const insertImage = element.find('button[data-action="insertImage"]'); | 292 | const insertImage = element.find('button[data-action="insertImage"]'); |
| 290 | 293 | ... | ... |
| ... | @@ -24,7 +24,7 @@ | ... | @@ -24,7 +24,7 @@ |
| 24 | text-align: center; | 24 | text-align: center; |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | -.edit-area.flex > .mce-tinymce.mce-container.mce-panel { | 27 | +.edit-area.flex > div > .mce-tinymce.mce-container.mce-panel { |
| 28 | height: 100%; | 28 | height: 100%; |
| 29 | max-height: 100%; | 29 | max-height: 100%; |
| 30 | flex: 1; | 30 | flex: 1; | ... | ... |
| ... | @@ -44,8 +44,11 @@ | ... | @@ -44,8 +44,11 @@ |
| 44 | 44 | ||
| 45 | <div class="edit-area flex-fill flex"> | 45 | <div class="edit-area flex-fill flex"> |
| 46 | @if(setting('app-editor') === 'wysiwyg') | 46 | @if(setting('app-editor') === 'wysiwyg') |
| 47 | - <textarea id="html-editor" tinymce="editorOptions" mce-change="editorChange" mce-model="editContent" name="html" rows="5" | 47 | + <div tinymce="editorOptions" mce-change="editorChange" mce-model="editContent" class="flex-fill flex"> |
| 48 | + <textarea id="html-editor" name="html" rows="5" ng-non-bindable | ||
| 48 | @if($errors->has('html')) class="neg" @endif>@if(isset($model) || old('html')){{htmlspecialchars( old('html') ? old('html') : $model->html)}}@endif</textarea> | 49 | @if($errors->has('html')) class="neg" @endif>@if(isset($model) || old('html')){{htmlspecialchars( old('html') ? old('html') : $model->html)}}@endif</textarea> |
| 50 | + </div> | ||
| 51 | + | ||
| 49 | @if($errors->has('html')) | 52 | @if($errors->has('html')) |
| 50 | <div class="text-neg text-small">{{ $errors->first('html') }}</div> | 53 | <div class="text-neg text-small">{{ $errors->first('html') }}</div> |
| 51 | @endif | 54 | @endif |
| ... | @@ -61,10 +64,14 @@ | ... | @@ -61,10 +64,14 @@ |
| 61 | <button class="text-button" type="button" data-action="insertImage"><i class="zmdi zmdi-image"></i>Insert Image</button> | 64 | <button class="text-button" type="button" data-action="insertImage"><i class="zmdi zmdi-image"></i>Insert Image</button> |
| 62 | </div> | 65 | </div> |
| 63 | </div> | 66 | </div> |
| 64 | - <textarea markdown-input md-change="editorChange" id="markdown-editor-input" md-model="editContent" name="markdown" rows="5" | 67 | + |
| 68 | + <div markdown-input md-change="editorChange" md-model="editContent" class="flex flex-fill"> | ||
| 69 | + <textarea ng-non-bindable id="markdown-editor-input" name="markdown" rows="5" | ||
| 65 | @if($errors->has('markdown')) class="neg" @endif>@if(isset($model) || old('markdown')){{htmlspecialchars( old('markdown') ? old('markdown') : ($model->markdown === '' ? $model->html : $model->markdown))}}@endif</textarea> | 70 | @if($errors->has('markdown')) class="neg" @endif>@if(isset($model) || old('markdown')){{htmlspecialchars( old('markdown') ? old('markdown') : ($model->markdown === '' ? $model->html : $model->markdown))}}@endif</textarea> |
| 66 | </div> | 71 | </div> |
| 67 | 72 | ||
| 73 | + </div> | ||
| 74 | + | ||
| 68 | <div class="markdown-editor-wrap"> | 75 | <div class="markdown-editor-wrap"> |
| 69 | <div class="editor-toolbar"> | 76 | <div class="editor-toolbar"> |
| 70 | <div class="">Preview</div> | 77 | <div class="">Preview</div> | ... | ... |
-
Please register or sign in to post a comment