Skip to content

Commit e40434b

Browse files
committed
DOC-3147: Update documentBaseUrl to include updated information.
1 parent 49d3206 commit e40434b

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

modules/ROOT/pages/migration-from-7x.adoc

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,18 +274,39 @@ The undocumented `editor.documentBaseUrl` property has been removed.
274274
[source,javascript]
275275
----
276276
// Removed in TinyMCE 8
277-
console.log(editor.documentBaseUrl);
277+
console.log('documentBaseUrl', editor.documentBaseUrl);
278278
279279
// Use this instead
280-
console.log(editor.editorManager.documentBaseURI);
280+
console.log('documentBaseURI', editor.documentBaseURI.getURI());
281281
----
282282

283-
TIP: Use `editor.editorManager.documentBaseURI` for all base URL operations.
283+
TIP: Use `tinymce.activeEditor.documentBaseURI.getURI()` for all base URL operations.
284284

285285
.Required Changes
286-
* Update all base URL references to use `editor.editorManager.documentBaseURI`
287286

288-
For more information regarding URL handling, see: xref:url-handling.adoc#document_base_uri[document_base_uri].
287+
To update all references of `documentBaseUrl` to the new API, replace any usage of `editor.documentBaseUrl` (or similar) with `tinymce.activeEditor.documentBaseURI.getURI()`. The property `documentBaseUrl` has been removed, and the correct way to access the document base URL is now through the `documentBaseURI` property, which is a URI object. You can then call `.getURI()` on it to get the string value of the URL.
288+
289+
.For example, update this:
290+
[source, js]
291+
----
292+
const baseUrl = editor.documentBaseUrl;
293+
----
294+
295+
to:
296+
297+
[source, js]
298+
----
299+
const baseUrl = tinymce.activeEditor.documentBaseURI.getURI();
300+
----
301+
302+
This change is necessary because the undocumented `editor.documentBaseUrl` API has been removed to improve URL handling consistency. The new approach uses the documented `documentBaseURI` property, which provides a URI object with methods such as `getURI()` to retrieve the full URL string.
303+
304+
For more information see: link:https://www.tiny.cloud/docs/tinymce/latest/apis/tinymce.editor/#properties[tinymce.editor/#properties].
305+
306+
**Migration checklist:**
307+
308+
* [ ] Search your codebase for all instances of `editor.documentBaseUrl`.
309+
* [ ] Replace them with `tinymce.activeEditor.documentBaseURI.getURI()` (or `editor.documentBaseURI.getURI()` if you have an `editor` reference).
289310

290311
'''
291312

0 commit comments

Comments
 (0)