Skip to content

Commit 2d92ee1

Browse files
committed
DOC-3147: Refactor crossorigin examples in documentation to clarify attribute handling and provide options for omitting the attribute.
1 parent 4598ad4 commit 2d92ee1

File tree

1 file changed

+11
-22
lines changed

1 file changed

+11
-22
lines changed

modules/ROOT/partials/configuration/crossorigin.adoc

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,13 @@ The `+crossorigin+` option controls how {productname} handles cross-origin resou
2121
[source,js]
2222
----
2323
tinymce.init({
24-
selector: 'textarea',
25-
crossorigin: (url, resourceType) => {
26-
// Return 'anonymous' for all resources
27-
return 'anonymous';
28-
}
29-
});
30-
----
31-
32-
=== Example: Conditional crossorigin attributes
33-
34-
[source,js]
35-
----
36-
tinymce.init({
37-
selector: 'textarea',
38-
crossorigin: (url, resourceType) => {
39-
if (url.startsWith('https://your-domain.com')) {
40-
return ''; // No crossorigin for same-origin resources
41-
}
42-
return 'anonymous'; // Use anonymous for cross-origin resources
43-
}
24+
selector: "textarea",
25+
crossorigin: (url, resourceType) => {
26+
// Returning 'anonymous' or 'use-credentials' here would explicitly set the attribute
27+
return 'anonymous';
28+
// return 'use-credentials';
29+
// return undefined; // Omit the 'crossorigin' attribute for all resources by returning undefined
30+
},
4431
});
4532
----
4633

@@ -75,8 +62,10 @@ The crossorigin function can also be set globally using `+tinymce.overrideDefaul
7562
tinymce.overrideDefaults({
7663
...tinymce.defaultOptions, // Preserve existing defaults
7764
crossorigin: (url, resourceType) => {
78-
// Your custom crossorigin logic
79-
return 'anonymous';
65+
// Returning 'anonymous' or 'use-credentials' here would explicitly set the attribute
66+
// return 'anonymous';
67+
// return 'use-credentials';
68+
return undefined; // Omit the 'crossorigin' attribute for all resources by returning undefined
8069
}
8170
});
8271
----

0 commit comments

Comments
 (0)