You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

539 lines
21 KiB

  1. = Migrating from {productname} 7 to {productname} {productmajorversion}
  2. :navtitle: Migrating from TinyMCE 7
  3. :description: Guidance for migrating from TinyMCE 7 to TinyMCE 8
  4. :keywords: migration, considerations, premigration, pre-migration
  5. :release-version: 8.0
  6. :page-toclevels: 3
  7. == Introduction
  8. This guide provides a comprehensive overview of the breaking changes introduced in {productname} {release-version}, along with the necessary steps to migrate from {productname} 7.x. It covers key updates to APIs, plugins, and service configurations, including deprecated methods, renamed components, and removed features. These changes are designed to enhance performance, simplify configuration, and align with modern web standards, ensuring a smoother transition and continued compatibility for your integrations.
  9. [IMPORTANT]
  10. .Breaking Changes Quick Reference
  11. ====
  12. The following table summarizes all breaking changes in {productname} {release-version}. Each item links to detailed information further in the guide.
  13. Any items marked **"High"** level require immediate attention during migration.
  14. [cols="2,3,1",options="header"]
  15. |===
  16. |Breaking Change |Impact |Level
  17. |xref:license-key-system-update[License Key System Update]
  18. |Self-hosted deployments now require a new license key format and license key manager. Old keys are **not compatible**.
  19. |High
  20. |xref:dompurify-update-breaking-change[DOMPurify Update and Stricter Sanitization]
  21. |Sanitization is now stricter; content previously allowed may be stripped or altered. See migration guide for details.
  22. |High
  23. |xref:editor-selection-setcontent-deprecated[editor.selection.setContent] Deprecated
  24. |Method deprecated. Use `editor.insertContent` instead.
  25. |Medium
  26. |xref:fire-method-deprecation[fire()] Method Deprecation
  27. |Method deprecated. Use `dispatch()` for event handling.
  28. |Medium
  29. |xref:pagebreak-split-block-default[pagebreak_split_block Default Value]
  30. |The default value changed from `false` to `true`, affecting how page breaks interact with block elements.
  31. |Low
  32. |xref:editor-documentbaseurl-removal[editor.documentBaseUrl] Removal
  33. |Undocumented property removed. Use `editor.editorManager.documentBaseURI` instead.
  34. |Low
  35. |xref:skipfocus-consolidation[skipFocus and skip_focus] Consolidation
  36. |Options consolidated to `skipFocus` in `ToggleToolbarDrawer`.
  37. |Low
  38. |===
  39. ====
  40. [[license-key-system-update]]
  41. === Transition from Version 7 License Keys to Version {release-version} License Keys
  42. // #EPIC-192
  43. [IMPORTANT]
  44. ====
  45. This section applies to self-hosted installations only. For cloud deployments, license key management is handled automatically.
  46. ====
  47. {productname} {release-version} introduces an enhanced license key system that requires specific attention during migration. The complete licensing documentation xref:license-key.adoc[License Key Management] covers:
  48. * Detailed explanations of all license types (GPL, Commercial, GPL with Premium Features)
  49. * Time-based vs Version-locked license key differences
  50. * License states (Active, Grace Period, Expired, Invalid)
  51. * Deployment options (Cloud-only, Self-hosted, Hybrid)
  52. * Step-by-step configuration examples for each setup
  53. * Commercial License Key Manager setup and requirements
  54. * Troubleshooting and FAQ
  55. ==== Key Migration Considerations
  56. * *License Key Format Change:* Version 7 keys are **not compatible** with {productname} {release-version}. New keys use the prefix `T8LK:` for commercial licenses or `GPL+T8LK:` for GPL with Premium Features.
  57. * *Mandatory Key Requirement:* Self-hosted deployments now **require** a valid license key; without one, the editor will be set to readonly.
  58. * *Commercial License Manager:* Self-hosted commercial deployments **require** the new license key manager addon.
  59. ==== Migration Steps
  60. . *Obtain New License Key:*
  61. ** link:https://www.tiny.cloud/contact/[Contact us] to obtain a new {productname} {release-version} license key, or use `gpl` for the open source version. See: xref:license-key.adoc#setting-the-license[setting the license] for details.
  62. . *Update Configuration:*
  63. +
  64. [source, javascript]
  65. ----
  66. // Old TinyMCE 7 configuration
  67. tinymce.init({
  68. selector: '#editor',
  69. // No license key required
  70. });
  71. // New TinyMCE 8 configuration
  72. tinymce.init({
  73. selector: '#editor',
  74. license_key: 'T8LK:...' // New format required
  75. });
  76. ----
  77. ==== License Key Manager Setup
  78. When migrating to TinyMCE {release-version} with a commercial license, the license key manager addon is required for the editor to operate. The setup varies based on your deployment method:
  79. . *CDN/Static Hosting:*
  80. ** Ensure the supplied `licensekeymanager` folder is in your {productname} plugins directory:
  81. +
  82. [tree]
  83. ----
  84. your-site/
  85. ├── tinymce/
  86. │ └── plugins/
  87. │ ├── licensekeymanager/ # Add this folder
  88. │ │ ├── plugin.min.js
  89. │ │ └── index.js
  90. │ └── ... other plugins
  91. ----
  92. . *NPM/Module Bundler:*
  93. ** Install TinyMCE and ensure the license key manager is imported:
  94. +
  95. [source, javascript]
  96. ----
  97. // Import TinyMCE
  98. import tinymce from 'tinymce';
  99. // Import the license key manager
  100. import 'tinymce/plugins/licensekeymanager';
  101. tinymce.init({
  102. selector: '#editor',
  103. license_key: 'T8LK:...' // New format required
  104. });
  105. ----
  106. . *React/Next.js:*
  107. ** When using the `@tinymce/tinymce-react` package:
  108. +
  109. [source, javascript]
  110. ----
  111. import { Editor } from '@tinymce/tinymce-react';
  112. import 'tinymce/plugins/licensekeymanager';
  113. export default function MyEditor() {
  114. return (
  115. <Editor
  116. init={{
  117. license_key: 'T8LK:...'
  118. }}
  119. />
  120. );
  121. }
  122. ----
  123. . *PHP/Laravel:*
  124. ** Ensure the license key manager is included when publishing {productname} assets:
  125. +
  126. [source, php]
  127. ----
  128. <script src="{{ asset('path/to/tinymce/tinymce.min.js') }}"></script>
  129. <script src="{{ asset('path/to/tinymce/plugins/licensekeymanager/plugin.min.js') }}"></script>
  130. <script>
  131. tinymce.init({
  132. selector: '#editor',
  133. license_key: 'T8LK:...'
  134. });
  135. </script>
  136. ----
  137. [IMPORTANT]
  138. ====
  139. * The license key manager is automatically included when using Tiny Cloud.
  140. * The plugin does not need to be added to the `plugins` configuration option.
  141. * For bundled applications, the license key manager must be loaded before {productname} initialization.
  142. * For bundled applications, ensure the license key manager is not excluded during build optimization.
  143. ====
  144. For complete details on license key manager setup and troubleshooting, see xref:license-key.adoc##setting-up-the-commercial-license-key-manager[Setting up the Commercial License Key Manager].
  145. **License Migration checklist:**
  146. * [ ] Contact support for new {productname} {release-version} license key or use GPL for the open source version
  147. * [ ] Install license key manager addon for commercial licenses
  148. * [ ] Update configuration with new license key format
  149. * [ ] Test editor functionality with new license
  150. * [ ] Verify all premium features are working
  151. [[dompurify-update-breaking-change]]
  152. === DOMPurify Update and Stricter Sanitization (Breaking Change)
  153. // #TINY-12056
  154. {productname} {release-version} updates the DOMPurify dependency to version 3.2.6 and enables the `SAFE_FOR_XML` flag by default. This is a breaking change: content that previously passed sanitization in {productname} 7 may now be stripped or altered during the sanitization process.
  155. [IMPORTANT]
  156. ====
  157. This change improves security and aligns with DOMPurify's recommended defaults. However, existing content and integrations that relied on the previous, less strict sanitization behavior may be impacted.
  158. ====
  159. ==== Key Changes
  160. * **DOMPurify upgraded to 3.2.6** — The custom patch is now included upstream; maintaining a forked patch is no longer required.
  161. * **`SAFE_FOR_XML` enabled** — This setting enforces stricter handling of comments and attribute values, preventing certain XSS vectors.
  162. * **Content Impact** — HTML comments containing tags, Internet Explorer conditional comments, and attributes with HTML-like values may now be removed during sanitization. Content that was previously allowed may be stripped.
  163. ==== Migration Guidance
  164. * Review workflows and test content that previously relied on relaxed sanitization.
  165. * If custom comment handling is required, consider using DOMPurify hooks as recommended by the maintainers.
  166. .Example: Content Differences
  167. |===
  168. |Content |{productname} 7 Output |{productname} {release-version} Output
  169. |`<div><!-- <p>Hello World</p> --></div>`
  170. |`<div><!-- <p>Hello World</p> --></div>`
  171. |`<div></div>`
  172. |`<iframe><!-- Hello World --></iframe>`
  173. |`<p><iframe sandbox=""><!-- Hello World --></iframe></p>`
  174. |``
  175. |`<script><!-- Hello World --></script>`
  176. |`<script><!-- Hello World --></script>`
  177. |``
  178. |===
  179. [NOTE]
  180. ====
  181. For information on disabling DOMPurify sanitization (not recommended), see xref:security.adoc#xss_sanitization-option[xss_sanitization option].
  182. ====
  183. == Core API Changes
  184. [discrete]
  185. === Breaking Changes Overview
  186. IMPORTANT: The following sections detail important changes that require updates to your code. Please review each section carefully.
  187. === Removed Methods
  188. [[editor-selection-setcontent-deprecated]]
  189. ==== editor.selection.setContent
  190. [.discrete]
  191. // #TINY-12109
  192. The `editor.selection.setContent` API has been deprecated and will be removed in {productname} 9.
  193. .Example Usage
  194. [source,javascript]
  195. ----
  196. // Deprecated in TinyMCE 8, will be removed in 9
  197. editor.selection.setContent('<p>New content</p>');
  198. // Recommended replacement
  199. editor.insertContent('<p>New content</p>');
  200. ----
  201. *Impact*: This change simplifies content manipulation by consolidating insertion methods.
  202. **Migration checklist:**
  203. * [ ] Replace all instances of `editor.selection.setContent` with `editor.insertContent`
  204. * [ ] Update custom plugins that use the old method
  205. * [ ] Test content insertion in your editor instances
  206. '''
  207. [[editor-documentbaseurl-removal]]
  208. ==== editor.documentBaseUrl
  209. [.discrete]
  210. // #TINY-12182
  211. The undocumented `editor.documentBaseUrl` property has been removed.
  212. .Example Usage
  213. [source,javascript]
  214. ----
  215. // Removed in TinyMCE 8
  216. console.log(editor.documentBaseUrl);
  217. // Use this instead
  218. console.log(editor.editorManager.documentBaseURI);
  219. ----
  220. TIP: Use `editor.editorManager.documentBaseURI` for all base URL operations.
  221. .Required Changes
  222. * Update all base URL references to use `editor.editorManager.documentBaseURI`
  223. For more information regarding URL handling, see: xref:url-handling.adoc#document_base_uri[document_base_uri].
  224. '''
  225. [[skipfocus-consolidation]]
  226. ==== skipFocus and skip_focus
  227. // #TINY-12044
  228. The `skipFocus` and `skip_focus` options for the `ToggleToolbarDrawer` command have been consolidated into a single, more consistent argument. This reduces API complexity and clarifies the intended behavior.
  229. [source, javascript]
  230. ----
  231. // Old approach (Deprecated) in TinyMCE 8
  232. editor.execCommand('ToggleToolbarDrawer', { skip_focus: false }, { skipFocus: true });
  233. // New approach (Recommended)
  234. editor.execCommand('ToggleToolbarDrawer', false, { skipFocus: true });
  235. ----
  236. **Impact**: This change simplifies focus management, reducing the risk of confusion and unexpected behavior.
  237. **Migration checklist:**
  238. * [ ] Locate all instances of `ToggleToolbarDrawer` command usage
  239. * [ ] Replace `skip_focus` with `skipFocus` in command options
  240. * [ ] Update any custom plugins using this command
  241. * [ ] Test toolbar drawer behavior after changes
  242. === Deprecated Methods
  243. [[fire-method-deprecation]]
  244. ==== `fire()`
  245. // #TINY-12012, ref TINY-8102
  246. The `fire()` method has been replaced by `dispatch()` for event handling. The `fire()` method will be removed in {productname} 9 to avoid confusion with its name.
  247. [source, javascript]
  248. ----
  249. // Deprecated in TinyMCE 8, will be removed in 9
  250. // Old approach for dispatching custom events
  251. editor.fire('someEvent');
  252. // New approach for dispatching custom events
  253. editor.dispatch('someEvent');
  254. ----
  255. **Impact**: This change aligns {productname} with modern event handling conventions, making the API more intuitive for developers.
  256. **Migration checklist:**
  257. * [ ] Search codebase for all uses of the `fire()` method
  258. * [ ] Replace each instance with `dispatch()`
  259. * [ ] Review and update third-party plugins
  260. * [ ] Test all custom event handling
  261. === Plugin Updates
  262. ==== Language Pack Filename Changes
  263. // #TINY-12090
  264. Language pack filenames have been standardized to follow the RFC5646 format. This update ensures consistent language handling across platforms and improves internationalization support. While both the legacy underscore format (e.g., `en_GB.js`) and the new hyphenated format (e.g., `en-GB.js`) are supported in {productname} {release-version}, the underscore format is deprecated and will be removed in {productname} 9. Migrating to the RFC5646 format now will ensure future compatibility and reduce maintenance overhead during upcoming upgrades.
  265. **Impact**: Custom language packs and configurations using the underscore-based format should update before upgrading to {productname} 9 to avoid loading failures.
  266. **Migration checklist:**
  267. * [ ] Identify all language pack files in your deployment
  268. * [ ] Rename files to RFC5646 format (e.g., `en_GB.js` → `en-GB.js`)
  269. * [ ] Update configuration references to language files
  270. * [ ] Update build scripts that handle language files
  271. * [ ] Test language switching in your application
  272. * [ ] Update custom translation files to use the new format
  273. [source, javascript]
  274. ----
  275. // Deprecated format (supported only in versions 8.x)
  276. language_url: '/langs/en_GB.js'
  277. // Recommended format
  278. language_url: '/langs/en-GB.js'
  279. ----
  280. [IMPORTANT]
  281. Support for the underscore format will be removed in {productname} 9. Early migration is recommended.
  282. ==== Update to Image and Accessibility Checker Plugins
  283. // #TINY-12226
  284. The Image and Accessibility Checker plugins now follow the latest W3C standards for decorative images, requiring an empty alt attribute rather than a `+role="presentation"+` attribute. This change helps improve accessibility support.
  285. **Impact**: Customers using these plugins will need to update their configurations to ensure continued compliance with accessibility standards.
  286. **Migration checklist:**
  287. * [ ] Identify images previously using `role="presentation"` for decorative purposes in your content
  288. * [ ] Replace those with empty alt attributes (`alt=""`)
  289. * [ ] Update image plugin configuration if customized
  290. * [ ] Test accessibility checker with updated content
  291. For more information on the changes, see: xref:a11ychecker.adoc##image-rules[Accessibility Checker: Image rules].
  292. ==== Page Break Plugin: Export PDF/Word Compatibility and Option Updates
  293. // #TINY-12013, #TINY-12462
  294. The Page Break plugin has been updated to work out-of-the-box with the xref:exportpdf.adoc[Export to PDF] and xref:exportword.adoc[Export to Word] plugins, addressing a common pain point for developers. As part of this update:
  295. * The default value of the xref:pagebreak.adoc#pagebreak_separator[`pagebreak_separator`] option now uses a block tag (`<div style="break-after: page
  296. * The default value of the xref:pagebreak.adoc#pagebreak_split_block[`pagebreak_split_block`] option has changed from `false` to `true`.
  297. This means that by default, inserting a page break will now automatically split block elements (such as paragraphs, lists, or tables) at the cursor position, and the separator will be compatible with both export services.
  298. **Impact**: These changes improve the export experience and provide a more intuitive editing experience.
  299. **Migration steps:**
  300. * If you want to restore the previous (v7) behavior, where page breaks do not automatically split block elements and use a comment tag as the separator, set both options explicitly in your configuration:
  301. [source, javascript]
  302. ----
  303. tinymce.init({
  304. // ...other configuration options...
  305. pagebreak_separator: '<!-- my page break -->',
  306. pagebreak_split_block: false
  307. });
  308. ----
  309. === Technical Improvements and Cleanup
  310. ==== Cross-Origin Resource Loading Configuration
  311. // #TINY-12228, TINY-12326
  312. When upgrading to {productname} 8, you will need to review and possibly update how your integration handles cross-origin resource loading. {productname} 8 provides a new configuration option for controlling the `crossorigin` attribute on loaded resources.
  313. **What to check:**
  314. . If you're using {cloudname}:
  315. +
  316. * Ensure your script tag includes both required attributes:
  317. +
  318. [source,html,subs="attributes+"]
  319. ----
  320. <script src="{cdnurl}" referrerpolicy="origin" crossorigin="anonymous"></script>
  321. ----
  322. +
  323. . If your application loads resources (scripts or stylesheets) from different domains:
  324. +
  325. * Configure the new crossorigin function in your `tinymce.init`:
  326. +
  327. [source, javascript]
  328. ----
  329. tinymce.init({
  330. selector: "textarea",
  331. crossorigin: (url, resourceType) => {
  332. // Returning 'anonymous' or 'use-credentials' here would explicitly set the attribute
  333. // return 'anonymous';
  334. // return 'use-credentials';
  335. return undefined; // Omit the 'crossorigin' attribute for all resources by returning undefined
  336. },
  337. });
  338. ----
  339. +
  340. . If you're using content_css from a different domain:
  341. * The `content_css_cors` option takes precedence for stylesheets.
  342. * Review your `content_css` configuration if you use cross-origin stylesheets.
  343. **Migration checklist:**
  344. * [ ] Verify script tag attributes for Cloud deployments.
  345. * [ ] Configure `crossorigin` function if using cross-origin resources.
  346. * [ ] Test resource loading in your deployment environment.
  347. * [ ] Review `content_css` configuration if using cross-origin stylesheets.
  348. For complete details on the new crossorigin function API, see: xref:tinymce-and-cors.adoc#crossorigin[crossorigin configuration option].
  349. ==== Removed Empty Files
  350. // #TINY-11287, #TINY-12084
  351. Several empty files have been removed from the codebase to reduce clutter and improve maintenance:
  352. * Empty CSS file from the Comments plugin
  353. * Empty LESS file from the Mentions plugin
  354. **Impact**: These changes have no functional impact but may affect custom build processes that explicitly reference these files.
  355. **Migration checklist:**
  356. * [ ] Check build processes for references to Comments plugin CSS
  357. * [ ] Check build processes for references to Mentions plugin LESS
  358. * [ ] Remove any imports of these empty files
  359. * [ ] Test Comments and Mentions plugins after removal
  360. === Service and Configuration Changes
  361. ==== Discontinuation of Medical English (UK)
  362. // #EPIC-255
  363. [WARNING]
  364. The "Medical English (UK)" dictionary has been removed due to licensing constraints. Customers using this feature must update their configurations accordingly.
  365. **Impact**: Users relying on this dictionary will need to make alternative arrangements for medical-specific spell checking.
  366. **Migration checklist:**
  367. * [ ] Remove "Medical English (UK)" from spellchecker configurations
  368. * [ ] Remove any custom dictionary integrations related to Medical English
  369. * [ ] Test spellchecker functionality with remaining dictionaries
  370. * [ ] Configure alternative medical dictionary if required
  371. ==== Decoupling of Service Versions from {productname} Editor
  372. // #EPIC-247, #EPIC-265
  373. Services previously bundled with the editor, such as Java Servlet services, are no longer included in {productname} {release-version} packages. Customers should migrate to xref:bundle-intro-setup.adoc[Containerized service deployments] or consider alternative hosting options.
  374. **Impact**: This reduces the dependency between the editor and backend services, simplifying updates and maintenance.
  375. **Migration steps:**
  376. * Update the applications deployment architecture to use xref:bundle-intro-setup.adoc[Containerized services] where applicable
  377. ==== Transition from Java WAR Files to Containerized Services
  378. // #EPIC-247
  379. {productname} {release-version} no longer includes Java WAR files for backend services like the spell checker. Customers are required to migrate to modern Docker/OCI containers for self-hosted deployments.
  380. **Impact**: This reduces infrastructure complexity and aligns with modern DevOps practices.
  381. **Migration checklist:**
  382. * [ ] Inventory current WAR file deployments
  383. * [ ] Review containerization requirements for your environment
  384. * [ ] Plan transition timeline to containerized services
  385. * [ ] Set up container infrastructure (Docker/Kubernetes)
  386. * [ ] Deploy and test containerized services
  387. * [ ] Update service connection configurations
  388. * [ ] Contact link:{supporturl}/[{supportname}] if legacy WAR files are still needed
  389. For more information on deploying the server-side components using Docker, see: xref:bundle-intro-setup.adoc[Containerized service deployments].
  390. == Conclusion
  391. Upgrading to {productname} {release-version} requires integrators to update their API calls, plugin configurations, and service integrations to accommodate the breaking changes introduced in this release. While some adjustments may involve significant code updates, these enhancements are intended to simplify development, and improve the overall editor experience.
  392. For more guidance, refer to the:
  393. * link:https://www.tiny.cloud/docs[{productname} Documentation],
  394. * Utilize our in-house **Ask AI** widget for general support found in the bottom corner of every documentation page, or
  395. * link:https://www.tiny.cloud/contact/[Contact {supportname}] for assistance.
  396. For additional details on {productname} {release-version} changes, see xref:8.0-release-notes.adoc#overview[{productname} {release-version} release notes].