\n
\n ${
55 | name ? name : "缩放"
56 | }\n
\n
\n \n
\n
`
57 | )),
58 | this.target
59 | );
60 | }),
61 | (t.prototype.getValue = function () {
62 | var t = this.target.find("input").val();
63 | if (t) return parseFloat(t.toString());
64 | }),
65 | (t.prototype.setValue = function (t) {
66 | // t: options 对应键的值
67 | this.target.find("input").val(t);
68 | }),
69 | (t.prototype.destroy = function () {
70 | this.target.remove();
71 | }),
72 | t
73 | );
74 | })(),
75 | ]);
76 | // transform 位置 idx
77 | let idx = Config.text.supportOptions.findIndex((o) => o.name === "transform");
78 | // 将 scale 插入到 transform 位置后面
79 | idx >= 0 &&
80 | Config.text.supportOptions.splice(idx + 1, 0, {
81 | name: "scale",
82 | hidden: false,
83 | });
84 | // 这里是 tabs 分组 的处理。 同上
85 | const tabIndex = Config.text.tabs.findIndex((t) => t.name === "样式");
86 | tabIndex >= 0 && (idx = Config.text.tabs[tabIndex].options.findIndex((o) => o.name === "transform"));
87 | idx &&
88 | Config.text.tabs[tabIndex].options.splice(idx + 1, 0, {
89 | name: "scale",
90 | hidden: false,
91 | });
92 | };
93 | // 这是才是插件 hooks 的实例
94 | // 可自定义插入的参数
95 | export default function (config?: any): PluginOptions {
96 | let configs = {
97 | ...config,
98 | };
99 | return {
100 | name: "scale",
101 | description: "「text」元素 缩放参数",
102 | hooks: [
103 | // 接受多个 hook 组合
104 | {
105 | hook: "init", // 这是 hook 关键
106 | name: "scale", // 名称(可选) 暂时没用到这个
107 | description: "testF", // 描述(可选) 暂时没用到这个
108 | priority: 1, // 排序优先级 (可选) 暂时没用到这个
109 | // hook
110 | run: (opts) => scale({ ...opts, ...configs }),
111 | },
112 | ],
113 | leastHiprintVersion: "0.1.0",
114 | };
115 | }
116 | ```
117 |
--------------------------------------------------------------------------------
/docs/README.md:
--------------------------------------------------------------------------------
1 | ---
2 | home: true
3 | icon: home
4 | title: sv-print
5 | heroImage: /logo.svg
6 | heroText: sv-print
7 | tagline: 使用svelte开发的打印设计器组件(基于hiprint);本文档会有 hiprint 和 sv-print 的使用说明。
8 | actions:
9 | - text: 使用指南 💡
10 | link: /guide/intro
11 |
12 | - text: 快速上手 🚀
13 | link: /guide/
14 | type: primary
15 |
16 | - text: 在线案例 🎾
17 | link: https://ccsimple.github.io/sv-print-demo/
18 |
19 | features:
20 | - title: 多框架UI 组件
21 | icon: layout
22 | details: 目前已提供 Svelte、Vue、Vue3、React框架的 UI 组件 npm 包。 点击查看
23 | link: https://www.npmjs.com/search?q=%40sv-print
24 |
25 | - title: 插件支持
26 | icon: blog
27 | details: 可自定义插件,自定义自己的打印元素等等。点击查看
28 | link: https://www.npmjs.com/search?q=%40sv-print%20plugin
29 |
30 | - title: 模板编辑/数据编辑
31 | icon: slides
32 | details: 内置 json 编辑器,可编辑当前模板 json 和 打印预览的数据。
33 |
34 | - title: 布局美化
35 | icon: layout
36 | details: 简约的设计布局,内置打印预览窗口,可添加可拖拽元素,自定义初始位置等等。
37 |
38 | - title: 自带多种主题
39 | icon: palette
40 | details: 支持自定义主题色并允许用户在预设的主题颜色之间切换 使用 daisyui
41 | link: https://daisyui.com/
42 |
43 | - title: 简约拖拽操作
44 | icon: support
45 | details: 支持框选、旋转、等比缩放、元素对齐、自定义可拖拽方向等等
46 |
47 | - title: 常用工具栏
48 | icon: config
49 | details: 常用编辑功能;如:撤销重做、对齐、复制粘贴、放大缩小等等,工具栏清晰明了
50 |
51 | - title: 更多功能
52 | icon: more
53 | details: 导入导出json模板、缩放、锁定编辑、快速放大/缩小字体等等
54 |
55 | copyright: false
56 | footer: LGPL Licensed | Copyright © 2022-present sv-print
57 | ---
58 |
59 |