generated from silverstripe/silverstripe-module
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Porting existing code from another project with up-to-date dependencies
- Ported existing code from another project with up-to-date dependencies. - Currently trying to integrating the embedding of images and other media using InsertEmbedModal and InsertMediaModal
- Loading branch information
1 parent
e9b9c4f
commit 5464626
Showing
28 changed files
with
24,457 additions
and
109 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,6 @@ | ||
{ | ||
"search.exclude": { | ||
"client/dist/**": true, | ||
"vendor/**": true | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,14 @@ | ||
// my-module/client/src/App.js | ||
import React from 'react'; | ||
import MarkdownEditorComponent from './components/MarkdownEditorComponent/MarkdownEditorComponent'; | ||
|
||
const App = (props) => ( | ||
<div id="bootstrapped_markdown_editor_component"> | ||
<MarkdownEditorComponent | ||
textArea={props.textArea} | ||
toolbar={props.toolbar} | ||
identifier={props.editorDataConfig.identifier}/> | ||
</div> | ||
); | ||
|
||
export default App; |
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 |
---|---|---|
@@ -1,6 +1,55 @@ | ||
/* global window */ | ||
import React from 'react'; | ||
import { createRoot } from 'react-dom/client'; | ||
import $ from 'jquery'; | ||
import { ApolloProvider } from '@apollo/client'; | ||
import Injector, { provideInjector } from 'lib/Injector'; | ||
import registerComponents from 'boot/registerComponents'; | ||
|
||
window.document.addEventListener('DOMContentLoaded', () => { | ||
registerComponents(); | ||
import App from 'App'; | ||
|
||
registerComponents(); | ||
|
||
Injector.ready(() => { | ||
// const ss = typeof window.ss !== 'undefined' ? window.ss : {}; | ||
const { apolloClient, store } = window.ss; | ||
const AppWithInjector = provideInjector(App); | ||
|
||
$('.js-markdown-container:visible').entwine({ | ||
ReactRoot: null, | ||
|
||
onmatch() { | ||
this._super(); | ||
this.refresh(); | ||
}, | ||
|
||
onunmatch() { | ||
this._super(); | ||
const root = this.getReactRoot(); | ||
if (root) { | ||
root.unmount(); | ||
this.setReactRoot(null); | ||
} | ||
}, | ||
|
||
refresh() { | ||
const textArea = $(this).parent().find('textarea')[0]; | ||
const editorDataConfig = JSON.parse(textArea.dataset.config); | ||
const toolbar = window.ss.markdownConfigs.readToolbarConfigs( | ||
editorDataConfig.toolbar | ||
); | ||
|
||
const root = createRoot(this[0]); | ||
this.setReactRoot(root); | ||
root.render( | ||
<ApolloProvider client={apolloClient} store={store}> | ||
<AppWithInjector | ||
textArea={textArea} | ||
editorDataConfig={editorDataConfig} | ||
toolbar={toolbar} | ||
/> | ||
</ApolloProvider> | ||
); | ||
}, | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,11 +1,9 @@ | ||
import Injector from 'lib/Injector'; | ||
import ExampleComponent from 'components/ExampleComponent/ExampleComponent'; | ||
import MarkdownEditorComponent from 'components/MarkdownEditorComponent/MarkdownEditorComponent'; | ||
|
||
export default () => { | ||
Injector.component.registerMany({ | ||
// List your React components here so Injector is aware of them | ||
ExampleComponent, | ||
MarkdownEditorComponent | ||
}); | ||
}; |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
// Include any legacy Entwine wrappers | ||
import 'entwine/example-file'; | ||
import 'entwine/Markdown_ssembed'; | ||
import 'entwine/Markdown_ssmedia'; | ||
|
||
// Include boot entrypoint | ||
import 'boot'; | ||
import 'boot/index'; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
client/src/components/ExampleComponent/tests/ExampleComponent-test.js
This file was deleted.
Oops, something went wrong.
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
Empty file.
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.