Merge remote-tracking branch 'origin/staging' into staging-render

This commit is contained in:
Andrey Antukh
2025-12-01 10:11:06 +01:00
14 changed files with 137 additions and 65 deletions

9
frontend/scripts/test Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -ex
corepack enable;
corepack install;
yarn install;
yarn run lint:scss;
yarn run test;

View File

@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -ex
corepack enable;
corepack install;
yarn install;
yarn run playwright install chromium --with-deps;
yarn run build:storybook
exec npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"npx http-server storybook-static --port 6006 --silent" \
"npx wait-on tcp:6006 && yarn test:storybook"

8
frontend/scripts/test-e2e Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -ex
corepack enable;
corepack install;
yarn install;
yarn run playwright install chromium --with-deps;
yarn run test:e2e -x --workers=2 --reporter=list "$@";

View File

@@ -7,6 +7,8 @@
(ns app.plugins.parser
(:require
[app.common.data :as d]
[app.common.json :as json]
[app.common.types.path :as path]
[app.common.uuid :as uuid]
[app.util.object :as obj]
[cuerdas.core :as str]))
@@ -514,3 +516,8 @@
(case axis
"horizontal" :y
"vertical" :x))
(defn parse-commands
[commands]
(-> (json/->clj commands)
(path/decode-segments)))

View File

@@ -1034,8 +1034,8 @@
(fn []
(let [shape (u/locate-shape file-id page-id id)]
(cond
(not (cfh/path-shape? shape))
(u/display-not-valid :makeMask (:type shape))
(and (not (cfh/path-shape? shape)) (not (cfh/bool-shape? shape)))
(u/display-not-valid :toD (:type shape))
:else
(.toString (:content shape)))))
@@ -1488,13 +1488,37 @@
(cond-> (or (cfh/path-shape? data) (cfh/bool-shape? data))
(crc/add-properties!
{:name "content"
{:name "commands"
:get #(-> % u/proxy->shape :content format/format-path-content)
:set
(fn [_ value]
(let [segments (parser/parse-commands value)]
(cond
(not (r/check-permission plugin-id "content:write"))
(u/display-not-valid :content "Plugin doesn't have 'content:write' permission")
(not (sm/validate path/schema:segments segments))
(u/display-not-valid :content segments)
:else
(let [selrect (path/calc-selrect segments)
content (path/from-plain segments)
points (grc/rect->points selrect)]
(st/emit! (dwsh/update-shapes
[id]
(fn [shape]
(-> shape
(assoc :content content)
(assoc :selrect selrect)
(assoc :points points)))))))))}
{:name "d"
:get #(-> % u/proxy->shape :content str)
:set
(fn [_ value]
(let [segments (if (string? value)
(svg.path/parse value)
value)]
(let [segments
(if (string? value)
(svg.path/parse value)
value)]
(cond
(not (r/check-permission plugin-id "content:write"))
(u/display-not-valid :content "Plugin doesn't have 'content:write' permission")
@@ -1514,4 +1538,7 @@
(-> shape
(assoc :content content)
(assoc :selrect selrect)
(assoc :points points)))))))))}))))))
(assoc :points points)))))))))}
{:name "content"
:get #(.-d %)
:set (fn [self value] (set! (.-d self) value))}))))))