Skip to content

Commit fd7211f

Browse files
mfloreamanuelleduc
authored andcommitted
XWIKI-23459: Upgrade to Cristal 0.22.0
1 parent 6910589 commit fd7211f

File tree

10 files changed

+575
-536
lines changed

10 files changed

+575
-536
lines changed

xwiki-platform-core/xwiki-platform-blocknote/xwiki-platform-blocknote-test/xwiki-platform-blocknote-test-docker/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<groupId>org.xwiki.platform</groupId>
4343
<artifactId>xwiki-platform-blocknote-api</artifactId>
4444
<version>${project.version}</version>
45+
<scope>runtime</scope>
4546
</dependency>
4647
<!-- Test only dependencies -->
4748
<dependency>

xwiki-platform-core/xwiki-platform-blocknote/xwiki-platform-blocknote-test/xwiki-platform-blocknote-test-docker/src/test/it/org/xwiki/blocknote/test/ui/BlockNoteIT.java

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,20 @@
1919
*/
2020
package org.xwiki.blocknote.test.ui;
2121

22+
import org.junit.jupiter.api.Test;
23+
import org.openqa.selenium.By;
24+
import org.openqa.selenium.WebElement;
25+
import org.openqa.selenium.interactions.Actions;
26+
import org.xwiki.test.docker.junit5.TestReference;
2227
import org.xwiki.test.docker.junit5.UITest;
28+
import org.xwiki.test.ui.TestUtils;
29+
import org.xwiki.test.ui.XWikiWebDriver;
30+
import org.xwiki.test.ui.po.ViewPage;
31+
import org.xwiki.test.ui.po.editor.WYSIWYGEditPage;
32+
33+
import static org.junit.jupiter.api.Assertions.assertEquals;
34+
import static org.openqa.selenium.Keys.CONTROL;
35+
import static org.openqa.selenium.Keys.END;
2336

2437
/**
2538
* Tests of the BlockNote integration.
@@ -30,4 +43,40 @@
3043
@UITest
3144
class BlockNoteIT
3245
{
33-
}
46+
/**
47+
* Run the minimal steps to validate the editor is loading: edit an existing page, add some content, save the
48+
* result.
49+
*/
50+
@Test
51+
void minimal(TestUtils setup, TestReference testReference)
52+
{
53+
setup.loginAsSuperAdmin();
54+
// Make Blocknote the default to not have to explicit it later.
55+
setup.addObject("XWiki", "XWikiPreferences", "XWiki.EditorBindingClass", "dataType",
56+
"org.xwiki.rendering.syntax.SyntaxContent#wysiwyg", "roleHint", "blocknote");
57+
// Make the user advance to have access to the edit dropdown.
58+
setup.createUserAndLogin("U1", "$U1", "editor", "Wysiwyg", "usertype", "Advanced");
59+
60+
// Create a page with a small content, edit it, add a little basic content, save and observe the content
61+
// changed.
62+
String textContent = "Test";
63+
ViewPage page = setup.createPage(testReference, textContent, "", "markdown/1.2");
64+
page.edit();
65+
XWikiWebDriver driver = setup.getDriver();
66+
WebElement blocknoteEditableContent = driver
67+
.findElement(By.cssSelector(".xwiki-blocknote .bn-container .bn-editor"));
68+
assertEquals(textContent, blocknoteEditableContent.getText());
69+
String addedContent = "123";
70+
blocknoteEditableContent.click();
71+
72+
// Move cursor to end using keyboard shortcuts, then insert the content.
73+
Actions actions = new Actions(driver.getWrappedDriver());
74+
actions.keyDown(CONTROL).sendKeys(END).keyUp(CONTROL)
75+
.sendKeys(addedContent)
76+
.perform();
77+
ViewPage postSavePage = new WYSIWYGEditPage().clickSaveAndView();
78+
assertEquals("""
79+
%s
80+
%s""".formatted(textContent, addedContent), postSavePage.getContent());
81+
}
82+
}

xwiki-platform-core/xwiki-platform-blocknote/xwiki-platform-blocknote-webjar/src/main/node/package.json

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,25 @@
99
"lint": "eslint \"./src/**/*.{js,ts,vue}\" --fix --max-warnings=0"
1010
},
1111
"dependencies": {
12-
"@blocknote/core": "0.31.3",
13-
"@blocknote/mantine": "0.31.3",
14-
"@mantine/core": "8.1.1",
15-
"@xwiki/cristal-api": "0.19.0",
16-
"@xwiki/cristal-attachments-default": "0.19.0",
17-
"@xwiki/cristal-authentication-api": "0.19.0",
18-
"@xwiki/cristal-backend-api": "0.19.0",
19-
"@xwiki/cristal-document-api": "0.19.0",
20-
"@xwiki/cristal-dsapi": "0.19.0",
21-
"@xwiki/cristal-editors-blocknote-headless": "0.19.0",
22-
"@xwiki/cristal-editors-blocknote-react": "0.19.0",
23-
"@xwiki/cristal-link-suggest-api": "0.19.0",
24-
"@xwiki/cristal-model-api": "0.19.0",
25-
"@xwiki/cristal-model-reference-api": "0.19.0",
26-
"@xwiki/cristal-model-remote-url-api": "0.19.0",
27-
"@xwiki/cristal-uniast": "0.19.0",
12+
"@xwiki/cristal-api": "0.22.0",
13+
"@xwiki/cristal-attachments-default": "0.22.0",
14+
"@xwiki/cristal-authentication-api": "0.22.0",
15+
"@xwiki/cristal-backend-api": "0.22.0",
16+
"@xwiki/cristal-collaboration-api": "0.22.0",
17+
"@xwiki/cristal-document-api": "0.22.0",
18+
"@xwiki/cristal-dsapi": "0.22.0",
19+
"@xwiki/cristal-editors-blocknote-headless": "0.22.0",
20+
"@xwiki/cristal-editors-blocknote-react": "0.22.0",
21+
"@xwiki/cristal-link-suggest-api": "0.22.0",
22+
"@xwiki/cristal-model-api": "0.22.0",
23+
"@xwiki/cristal-model-reference-api": "0.22.0",
24+
"@xwiki/cristal-model-remote-url-api": "0.22.0",
25+
"@xwiki/cristal-uniast-api": "0.22.0",
26+
"@xwiki/cristal-uniast-markdown": "0.22.0",
2827
"inversify": "7.5.2",
2928
"pinia": "3.0.2",
30-
"react": "19.1.0",
31-
"react-dom": "19.1.0",
29+
"react": "19.1.1",
30+
"react-dom": "19.1.1",
3231
"vue-i18n": "11.1.12"
3332
},
3433
"peerDependencies": {
@@ -58,14 +57,6 @@
5857
"vue-tsc": "3.0.6"
5958
},
6059
"pnpm": {
61-
"overrides": {
62-
"@xwiki/cristal-fn-utils": "0.19.0",
63-
"@xwiki/cristal-model-api": "0.19.0",
64-
"@xwiki/cristal-model-reference-api": "0.19.0",
65-
"@xwiki/cristal-model-remote-url-api": "0.19.0",
66-
"inversify": "7.5.2",
67-
"vue": "3.5.22"
68-
},
6960
"onlyBuiltDependencies": [
7061
"esbuild"
7162
]

0 commit comments

Comments
 (0)