Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Avoid using Jodit in printview #4405

Open
sorja opened this issue Feb 27, 2025 · 1 comment
Open

Proposal: Avoid using Jodit in printview #4405

sorja opened this issue Feb 27, 2025 · 1 comment
Assignees
Labels
discussion It requires a discussion before implementation

Comments

@sorja
Copy link
Contributor

sorja commented Feb 27, 2025

Jodit is quite heavy library, would it be better to avoid using it in the printview?
Needs some benchmarking etc

Example:

--- src/client/components/EditorWYSIWYG/EditorWYSIWYGSwitch.tsx

import React from 'react'

import { useIsPrintRoute } from 'client/hooks/useIsRoute'

import { EditorWYSIWYGProps } from './EditorWYSIWYG'
import EditorWYSIWYGWithRepositoryContext from './EditorWYSIWYGWithRepositoryContext'

const EditorWYSIWYGSwitch: React.FC<EditorWYSIWYGProps> = (props: EditorWYSIWYGProps) => {
  const { value } = props
  const { print } = useIsPrintRoute()

  if (print) {
    return <div className="wysiwyg-print-content" dangerouslySetInnerHTML={{ __html: value || '' }} />
  }

  return <EditorWYSIWYGWithRepositoryContext {...props} />
}

export default EditorWYSIWYGSwitch

-- src/client/components/EditorWYSIWYG/index.ts

 export { default as EditorWYSIWYGLinks } from './EditorWYSIWYGLinks'
-export { default } from './EditorWYSIWYGWithRepositoryContext'
+export { default } from './EditorWYSIWYGSwitch'
 export { EditorValidators } from './validators'


@sorja sorja added the discussion It requires a discussion before implementation label Feb 27, 2025
@minotogna
Copy link
Member

@sorja can u try ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion It requires a discussion before implementation
Projects
None yet
Development

No branches or pull requests

2 participants