Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* commit '34d5775bd7c092a826b9def7b690b5855a6d44ea': TINY-1514: added a ui_container demo TINY-1514: fixed so there can be multiple ui_containers TINY-1514: fixed various issues with the ui_container option
- Loading branch information
Showing
15 changed files
with
331 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>ui_container Demo Page</title> | ||
</head> | ||
|
||
<body> | ||
<div id="left" style="position: relative; right: 10px; top: 10px; width: 500px; height: 500px; overflow: scroll; margin: 40px; padding: 20px; border: 1px solid black"> | ||
<h2 style="height: 400px">Left side iframe</h2> | ||
<textarea> | ||
<table style="border-collapse: collapse; width: 100%;" border="1"> | ||
<tbody> | ||
<tr> | ||
<td style="width: 50%;"> </td> | ||
<td style="width: 50%;"> </td> | ||
</tr> | ||
<tr> | ||
<td style="width: 50%;"> </td> | ||
<td style="width: 50%;"> </td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</textarea> | ||
|
||
<h2>Left side inline</h2> | ||
<div class="tinymce" style="margin-bottom: 1000px"> | ||
<table style="border-collapse: collapse; width: 100%;" border="1"> | ||
<tbody> | ||
<tr> | ||
<td style="width: 50%;"> </td> | ||
<td style="width: 50%;"> </td> | ||
</tr> | ||
<tr> | ||
<td style="width: 50%;"> </td> | ||
<td style="width: 50%;"> </td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
|
||
<div id="right" style="position: absolute; right: 10px; top: 10px; width: 500px; height: 500px; overflow: scroll; margin: 40px; padding: 20px; border: 1px solid black"> | ||
<h2 style="height: 400px">Right side iframe</h2> | ||
<textarea> | ||
<table style="border-collapse: collapse; width: 100%;" border="1"> | ||
<tbody> | ||
<tr> | ||
<td style="width: 50%;"> </td> | ||
<td style="width: 50%;"> </td> | ||
</tr> | ||
<tr> | ||
<td style="width: 50%;"> </td> | ||
<td style="width: 50%;"> </td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</textarea> | ||
|
||
<h2>Right side inline</h2> | ||
<div class="tinymce" style="margin-bottom: 1000px"> | ||
<table style="border-collapse: collapse; width: 100%;" border="1"> | ||
<tbody> | ||
<tr> | ||
<td style="width: 50%;"> </td> | ||
<td style="width: 50%;"> </td> | ||
</tr> | ||
<tr> | ||
<td style="width: 50%;"> </td> | ||
<td style="width: 50%;"> </td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
|
||
<script src="../../../../js/tinymce/tinymce.js"></script> | ||
<script src="../../../../scratch/demos/core/demo.js"></script> | ||
<script>demos.UiContainerDemo();</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
/** | ||
* UiContainer.ts | ||
* | ||
* Released under LGPL License. | ||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved | ||
* | ||
* License: http://www.tinymce.com/license | ||
* Contributing: http://www.tinymce.com/contributing | ||
*/ | ||
|
||
import { Merger } from '@ephox/katamari'; | ||
|
||
declare let tinymce: any; | ||
|
||
export default function () { | ||
const generalSettings = { | ||
skin_url: '../../../../js/tinymce/skins/lightgray', | ||
codesample_content_css: '../../../../js/tinymce/plugins/codesample/css/prism.css', | ||
visualblocks_content_css: '../../../../js/tinymce/plugins/visualblocks/css/visualblocks.css', | ||
images_upload_url: 'd', | ||
// rtl_ui: true, | ||
link_list: [ | ||
{ title: 'My page 1', value: 'http://www.tinymce.com' }, | ||
{ title: 'My page 2', value: 'http://www.moxiecode.com' } | ||
], | ||
image_list: [ | ||
{ title: 'My page 1', value: 'http://www.tinymce.com' }, | ||
{ title: 'My page 2', value: 'http://www.moxiecode.com' } | ||
], | ||
image_class_list: [ | ||
{ title: 'None', value: '' }, | ||
{ title: 'Some class', value: 'class-name' } | ||
], | ||
importcss_append: true, | ||
height: 400, | ||
file_picker_callback (callback, value, meta) { | ||
// Provide file and text for the link dialog | ||
if (meta.filetype === 'file') { | ||
callback('https://www.google.com/logos/google.jpg', { text: 'My text' }); | ||
} | ||
|
||
// Provide image and alt text for the image dialog | ||
if (meta.filetype === 'image') { | ||
callback('https://www.google.com/logos/google.jpg', { alt: 'My alt text' }); | ||
} | ||
|
||
// Provide alternative source and posted for the media dialog | ||
if (meta.filetype === 'media') { | ||
callback('movie.mp4', { source2: 'alt.ogg', poster: 'https://www.google.com/logos/google.jpg' }); | ||
} | ||
}, | ||
spellchecker_callback (method, text, success, failure) { | ||
const words = text.match(this.getWordCharPattern()); | ||
|
||
if (method === 'spellcheck') { | ||
const suggestions = {}; | ||
|
||
for (let i = 0; i < words.length; i++) { | ||
suggestions[words[i]] = ['First', 'Second']; | ||
} | ||
|
||
success(suggestions); | ||
} | ||
|
||
if (method === 'addToDictionary') { | ||
success(); | ||
} | ||
}, | ||
templates: [ | ||
{ title: 'Some title 1', description: 'Some desc 1', content: 'My content' }, | ||
{ title: 'Some title 2', description: 'Some desc 2', content: '<div class="mceTmpl"><span class="cdate">cdate</span><span class="mdate">mdate</span>My content2</div>' } | ||
], | ||
template_cdate_format: '[CDATE: %m/%d/%Y : %H:%M:%S]', | ||
template_mdate_format: '[MDATE: %m/%d/%Y : %H:%M:%S]', | ||
image_caption: true, | ||
theme: 'modern', | ||
mobile: { | ||
plugins: [ | ||
'autosave lists' | ||
] | ||
}, | ||
plugins: [ | ||
'autosave advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker toc', | ||
'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking', | ||
'save table contextmenu directionality emoticons template paste textcolor importcss colorpicker textpattern', | ||
'codesample help noneditable print' | ||
], | ||
// rtl_ui: true, | ||
add_unload_trigger: false, | ||
autosave_ask_before_unload: false | ||
}; | ||
|
||
const iframeSettings = Merger.deepMerge(generalSettings, { | ||
toolbar: 'fontsizeselect fontselect insertfile undo redo | insert | styleselect | bold italic | alignleft aligncenter alignright alignjustify | ' + | ||
'bullist numlist outdent indent | link image | print preview media fullpage | forecolor backcolor emoticons table codesample code | ltr rtl' | ||
}); | ||
|
||
const inlineSettings = Merger.deepMerge(generalSettings, { | ||
inline: true, | ||
toolbar: [ | ||
'fontsizeselect fontselect insertfile undo redo | insert | styleselect', | ||
'bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image', | ||
'print preview media fullpage | forecolor backcolor emoticons table codesample code | ltr rtl' | ||
] | ||
}); | ||
|
||
tinymce.init(Merger.deepMerge(iframeSettings, { | ||
selector: '#left textarea', | ||
ui_container: '#left' | ||
})); | ||
|
||
tinymce.init(Merger.deepMerge(inlineSettings, { | ||
selector: '#left div.tinymce', | ||
ui_container: '#left' | ||
})); | ||
|
||
tinymce.init(Merger.deepMerge(iframeSettings, { | ||
selector: '#right textarea', | ||
ui_container: '#right' | ||
})); | ||
|
||
tinymce.init(Merger.deepMerge(inlineSettings, { | ||
selector: '#right div.tinymce', | ||
ui_container: '#right' | ||
})); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* UiContainer.js | ||
* | ||
* Released under LGPL License. | ||
* Copyright (c) 1999-2018 Ephox Corp. All rights reserved | ||
* | ||
* License: http://www.tinymce.com/license | ||
* Contributing: http://www.tinymce.com/contributing | ||
*/ | ||
|
||
import DOMUtils from 'tinymce/core/api/dom/DOMUtils'; | ||
import { Editor } from 'tinymce/core/api/Editor'; | ||
|
||
const getUiContainer = (editor: Editor): HTMLElement => { | ||
return DOMUtils.DOM.select(editor.settings.ui_container)[0]; | ||
}; | ||
|
||
export { | ||
getUiContainer | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.