Skip to content

Commit

Permalink
DEP Update code to work with upgraded libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Dec 7, 2022
1 parent 1f734b5 commit 09961fa
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 15 deletions.
2 changes: 1 addition & 1 deletion client/src/legacy/CMSMain.EditForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import $ from 'jquery';
import i18n from 'i18n';
import reactConfirm from "@silverstripe/reactstrap-confirm";
import reactConfirm from 'reactstrap-confirm';

$.entwine('ss', function($){
/**
Expand Down
2 changes: 1 addition & 1 deletion client/src/legacy/CMSMain.Tree.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import $ from 'jquery';
import i18n from 'i18n';
import reactConfirm from "@silverstripe/reactstrap-confirm";
import reactConfirm from 'reactstrap-confirm';

$.entwine('ss.tree', function($) {
$('.cms-tree').entwine({
Expand Down
16 changes: 11 additions & 5 deletions client/src/legacy/TinyMCE_sslink-anchor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import i18n from 'i18n';
import TinyMCEActionRegistrar from 'lib/TinyMCEActionRegistrar';
import React from 'react';
import ReactDOM from 'react-dom';
import { ApolloProvider } from 'react-apollo';
import { createRoot } from 'react-dom/client';
import { ApolloProvider } from '@apollo/client';
import { Provider } from 'react-redux';
import jQuery from 'jquery';
import ShortcodeSerialiser from 'lib/ShortcodeSerialiser';
Expand Down Expand Up @@ -68,6 +68,8 @@ jQuery.entwine('ss', ($) => {
* Assumes that $('.insert-link__dialog-wrapper').entwine({}); is defined for shared functions
*/
$(`#${modalId}`).entwine({
ReactRoot: null,

renderModal(isOpen) {
const store = ss.store;
const client = ss.apolloClient;
Expand All @@ -82,7 +84,12 @@ jQuery.entwine('ss', ($) => {
const currentPageID = Number($('#Form_EditForm_ID').val() || 0);

// create/update the react component
ReactDOM.render(
let root = this.getReactRoot();
if (!root) {
root = createRoot(this[0]);
this.setReactRoot(root);
}
root.render(
<ApolloProvider client={client}>
<Provider store={store}>
<InsertLinkInternalModal
Expand All @@ -98,8 +105,7 @@ jQuery.entwine('ss', ($) => {
currentPageID={currentPageID}
/>
</Provider>
</ApolloProvider>,
this[0]
</ApolloProvider>
);
},

Expand Down
16 changes: 11 additions & 5 deletions client/src/legacy/TinyMCE_sslink-internal.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import i18n from 'i18n';
import TinyMCEActionRegistrar from 'lib/TinyMCEActionRegistrar';
import React from 'react';
import ReactDOM from 'react-dom';
import { ApolloProvider } from 'react-apollo';
import { createRoot } from 'react-dom/client';
import { ApolloProvider } from '@apollo/client';
import { Provider } from 'react-redux';
import jQuery from 'jquery';
import ShortcodeSerialiser from 'lib/ShortcodeSerialiser';
Expand Down Expand Up @@ -60,6 +60,8 @@ jQuery.entwine('ss', ($) => {
* Assumes that $('.insert-link__dialog-wrapper').entwine({}); is defined for shared functions
*/
$(`#${modalId}`).entwine({
ReactRoot: null,

renderModal(isOpen) {
const store = ss.store;
const client = ss.apolloClient;
Expand All @@ -69,7 +71,12 @@ jQuery.entwine('ss', ($) => {
const requireLinkText = this.getRequireLinkText();

// create/update the react component
ReactDOM.render(
let root = this.getReactRoot();
if (!root) {
root = createRoot(this[0]);
this.setReactRoot(root);
}
root.render(
<ApolloProvider client={client}>
<Provider store={store}>
<InsertLinkInternalModal
Expand All @@ -84,8 +91,7 @@ jQuery.entwine('ss', ($) => {
requireLinkText={requireLinkText}
/>
</Provider>
</ApolloProvider>,
this[0]
</ApolloProvider>
);
},

Expand Down
2 changes: 1 addition & 1 deletion client/src/state/history/readOnePageQuery.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { graphql } from 'react-apollo';
import { graphql } from '@apollo/client/react/hoc';
import gql from 'graphql-tag';

// GraphQL query for retrieving the version history of a specific page. The
Expand Down
2 changes: 1 addition & 1 deletion client/src/state/history/revertToPageVersionMutation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { graphql } from 'react-apollo';
import { graphql } from '@apollo/client/react/hoc';
import gql from 'graphql-tag';

const mutation = gql`
Expand Down
2 changes: 1 addition & 1 deletion client/src/state/history/rollbackPageMutation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { graphql } from 'react-apollo';
import { graphql } from '@apollo/client/react/hoc';
import gql from 'graphql-tag';

const mutation = gql`
Expand Down

0 comments on commit 09961fa

Please sign in to comment.