Skip to content

Commit

Permalink
added SSMedia for media files
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsekaean committed Oct 15, 2017
1 parent 4fe86c9 commit b1f5137
Show file tree
Hide file tree
Showing 8 changed files with 523 additions and 680 deletions.
786 changes: 267 additions & 519 deletions client/dist/bundle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/dist/sourcemaps/bundle.min.css.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion client/src/bundles/bundle.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
require('../entwine/Markdown_ssembed');
require('../entwine/Markdown_ssembed')
require('../entwine/Markdown_ssmedia');
require('../components/MarkdownEditorField/MarkdownEditorField');
18 changes: 4 additions & 14 deletions client/src/components/MarkdownEditorField/MarkdownEditorField.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,30 +105,20 @@ jQuery.entwine('ss', ($) => {
},
{
name: "image",
//action: SimpleMDE.drawImage,

action: function(editor) {
/*
if(window.InsertMediaModal) {
let dialog = $('#insert-md-embed-react__dialog-wrapper');
let dialog = $('#insert-md-media-react__dialog-wrapper');
if (!dialog.length) {
dialog = $('<div id="insert-md-embed-react__dialog-wrapper" />');
$('body').append(dialog);
//dialog.dialog({
// autoOpen: false
// });
dialog = $('<div id="insert-md-media-react__dialog-wrapper" />');
$('body').append(dialog);
}
console.log(dialog);
dialog.setElement(editor);
dialog.open();
}
else {
SimpleMDE.drawImage(editor);
}
*/

},
className: "fa fa-picture-o",
title: "Insert Image",
Expand Down
136 changes: 0 additions & 136 deletions client/src/components/MarkdownEditorField/MarkdownEmbedModal.js

This file was deleted.

16 changes: 11 additions & 5 deletions client/src/entwine/Markdown_ssembed.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import ReactDOM from 'react-dom';

import { ApolloProvider } from 'react-apollo';
import { provideInjector } from 'lib/Injector';
import InsertEmbedModal from '../../../../asset-admin/client/src/components/InsertEmbedModal/InsertEmbedModal';

const InjectableInsertEmbedModal = provideInjector(InsertEmbedModal);
const InjectableInsertEmbedModal = provideInjector(window.InsertEmbedModal.default);

jQuery.entwine('ss', ($) => {

Expand Down Expand Up @@ -41,7 +39,7 @@ jQuery.entwine('ss', ($) => {
* @param {boolean} show
* @private
*/
_renderModal(show) { // alert('test');
_renderModal(show) {
const handleHide = () => this.close();
const handleInsert = (...args) => this._handleInsert(...args);
const handleCreate = (...args) => this._handleCreate(...args);
Expand All @@ -55,7 +53,6 @@ jQuery.entwine('ss', ($) => {
<ApolloProvider store={store} client={client}>
<InjectableInsertEmbedModal
show={show}
type="insert-media"
onCreate={handleCreate}
onInsert={handleInsert}
onHide={handleHide}
Expand Down Expand Up @@ -167,9 +164,18 @@ jQuery.entwine('ss', ($) => {
let pos = $field.codemirror.getCursor();
$field.codemirror.setSelection(pos, pos);
$field.codemirror.replaceSelection("\n" + $('<div />').append(base.clone()).html() + "\n");
updateTextarea();
return true;
},


updateTextarea()
{
const $field = this.getElement();
$($field.element).closest('.js-markdown-holder')
.find('textarea.markdowneditor').val($field.value());
}

});

});
Expand Down
Loading

0 comments on commit b1f5137

Please sign in to comment.