mirror of
https://github.com/penpot/penpot.git
synced 2026-05-25 18:03:43 +00:00
Merge remote-tracking branch 'origin/staging-render' into develop
This commit is contained in:
commit
0d194decbf
@ -115,21 +115,25 @@
|
|||||||
(defn get-frames
|
(defn get-frames
|
||||||
"Retrieves all frame objects as vector"
|
"Retrieves all frame objects as vector"
|
||||||
([objects] (get-frames objects nil))
|
([objects] (get-frames objects nil))
|
||||||
([objects {:keys [skip-components? skip-copies?]
|
([objects {:keys [skip-components? skip-copies? ignore-index?]
|
||||||
:or {skip-components? false
|
:or {skip-components? false
|
||||||
skip-copies? false}}]
|
skip-copies? false
|
||||||
(->> (or (-> objects meta ::index-frames)
|
ignore-index? false}}]
|
||||||
(let [lookup (d/getf objects)
|
(let [frame-index
|
||||||
xform (comp (remove #(= uuid/zero %))
|
(if (and (not ignore-index?) (-> objects meta ::index-frames))
|
||||||
(keep lookup)
|
(-> objects meta ::index-frames)
|
||||||
(filter cfh/frame-shape?))]
|
(let [lookup (d/getf objects)
|
||||||
(->> (keys objects)
|
xform (comp (remove #(= uuid/zero %))
|
||||||
(sequence xform))))
|
(keep lookup)
|
||||||
(remove #(or (and ^boolean skip-components?
|
(filter cfh/frame-shape?))]
|
||||||
^boolean (ctk/instance-head? %))
|
(->> (keys objects)
|
||||||
(and ^boolean skip-copies?
|
(sequence xform))))]
|
||||||
(and ^boolean (ctk/instance-head? %)
|
(->> frame-index
|
||||||
(not ^boolean (ctk/main-instance? %)))))))))
|
(remove #(or (and ^boolean skip-components?
|
||||||
|
^boolean (ctk/instance-head? %))
|
||||||
|
(and ^boolean skip-copies?
|
||||||
|
(and ^boolean (ctk/instance-head? %)
|
||||||
|
(not ^boolean (ctk/main-instance? %))))))))))
|
||||||
|
|
||||||
(defn get-frames-ids
|
(defn get-frames-ids
|
||||||
"Retrieves all frame ids as vector"
|
"Retrieves all frame ids as vector"
|
||||||
|
|||||||
@ -242,7 +242,7 @@
|
|||||||
[{:keys [objects zoom selected focus is-show-artboard-names
|
[{:keys [objects zoom selected focus is-show-artboard-names
|
||||||
on-frame-enter on-frame-leave on-frame-select]}]
|
on-frame-enter on-frame-leave on-frame-select]}]
|
||||||
(let [selected (or selected #{})
|
(let [selected (or selected #{})
|
||||||
shapes (ctt/get-frames objects {:skip-copies? true})
|
shapes (ctt/get-frames objects {:skip-copies? true :ignore-index? true})
|
||||||
shapes (if (dbg/enabled? :shape-titles)
|
shapes (if (dbg/enabled? :shape-titles)
|
||||||
(into (set shapes)
|
(into (set shapes)
|
||||||
(map (d/getf objects))
|
(map (d/getf objects))
|
||||||
|
|||||||
@ -19,6 +19,8 @@
|
|||||||
[rumext.v2 :as mf])
|
[rumext.v2 :as mf])
|
||||||
(:import goog.events.EventType))
|
(:import goog.events.EventType))
|
||||||
|
|
||||||
|
(def caret-blink-interval-ms 250)
|
||||||
|
|
||||||
(defn- sync-wasm-text-editor-content!
|
(defn- sync-wasm-text-editor-content!
|
||||||
"Sync WASM text editor content back to the shape via the standard
|
"Sync WASM text editor content back to the shape via the standard
|
||||||
commit pipeline. Called after every text-modifying input."
|
commit pipeline. Called after every text-modifying input."
|
||||||
@ -54,18 +56,17 @@
|
|||||||
(.focus node))
|
(.focus node))
|
||||||
js/undefined))
|
js/undefined))
|
||||||
|
|
||||||
;; Animation loop for cursor blink
|
|
||||||
(mf/use-effect
|
(mf/use-effect
|
||||||
(fn []
|
(fn []
|
||||||
(let [raf-id (atom nil)
|
(let [timeout-id (atom nil)
|
||||||
animate (fn animate []
|
schedule-blink (fn schedule-blink []
|
||||||
(when (text-editor/text-editor-is-active?)
|
(when (text-editor/text-editor-is-active?)
|
||||||
(wasm.api/request-render "cursor-blink")
|
(wasm.api/request-render "cursor-blink"))
|
||||||
(reset! raf-id (js/requestAnimationFrame animate))))]
|
(reset! timeout-id (js/setTimeout schedule-blink caret-blink-interval-ms)))]
|
||||||
(animate)
|
(schedule-blink)
|
||||||
(fn []
|
(fn []
|
||||||
(when @raf-id
|
(when @timeout-id
|
||||||
(js/cancelAnimationFrame @raf-id))))))
|
(js/clearTimeout @timeout-id))))))
|
||||||
|
|
||||||
;; Document-level keydown handler for control keys
|
;; Document-level keydown handler for control keys
|
||||||
(mf/use-effect
|
(mf/use-effect
|
||||||
|
|||||||
@ -1958,6 +1958,8 @@ export class SelectionController extends EventTarget {
|
|||||||
this.startOffset === this.endOffset &&
|
this.startOffset === this.endOffset &&
|
||||||
this.endOffset === endNode.nodeValue?.length
|
this.endOffset === endNode.nodeValue?.length
|
||||||
) {
|
) {
|
||||||
|
const paragraph = this.startParagraph;
|
||||||
|
setParagraphStyles(paragraph, newStyles);
|
||||||
const newTextSpan = createVoidTextSpan(newStyles);
|
const newTextSpan = createVoidTextSpan(newStyles);
|
||||||
this.endTextSpan.after(newTextSpan);
|
this.endTextSpan.after(newTextSpan);
|
||||||
this.setSelection(newTextSpan.firstChild, 0, newTextSpan.firstChild, 0);
|
this.setSelection(newTextSpan.firstChild, 0, newTextSpan.firstChild, 0);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user