|
@@ -10,9 +10,10 @@ import { Button, Dropdown, InputNumber, Menu, Tooltip } from "ant-design-vue";
|
|
|
|
|
|
import Pickr from "@simonwep/pickr";
|
|
import Pickr from "@simonwep/pickr";
|
|
import "@simonwep/pickr/dist/themes/nano.min.css";
|
|
import "@simonwep/pickr/dist/themes/nano.min.css";
|
|
-import { defineComponent, onMounted, reactive } from "vue";
|
|
|
|
|
|
+import { defineComponent, onMounted, reactive, watch } from "vue";
|
|
import { any, string } from "vue-types";
|
|
import { any, string } from "vue-types";
|
|
import Select from "@queenjs-modules/queditor/components/FormUI/Items/Select";
|
|
import Select from "@queenjs-modules/queditor/components/FormUI/Items/Select";
|
|
|
|
+import { queenApi } from "queenjs";
|
|
|
|
|
|
export const TextColor = defineComponent({
|
|
export const TextColor = defineComponent({
|
|
props: {
|
|
props: {
|
|
@@ -21,6 +22,7 @@ export const TextColor = defineComponent({
|
|
emits: ["change"],
|
|
emits: ["change"],
|
|
setup(props, { emit }) {
|
|
setup(props, { emit }) {
|
|
let picker: any = null;
|
|
let picker: any = null;
|
|
|
|
+
|
|
function initPicker() {
|
|
function initPicker() {
|
|
picker = Pickr.create({
|
|
picker = Pickr.create({
|
|
el: ".color_picker",
|
|
el: ".color_picker",
|
|
@@ -43,16 +45,23 @@ export const TextColor = defineComponent({
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
|
|
- picker.on("change", (color: any) => {
|
|
|
|
- const hexa = color.toHEXA().toString();
|
|
|
|
- // emit("change", hexa);
|
|
|
|
- });
|
|
|
|
|
|
+ // picker.on("change", (color: any) => {
|
|
|
|
+ // const hexa = color.toHEXA().toString();
|
|
|
|
+ // console.log("change", hexa);
|
|
|
|
+ // // emit("change", hexa);
|
|
|
|
+ // });
|
|
picker.on("save", (color: any) => {
|
|
picker.on("save", (color: any) => {
|
|
picker.hide();
|
|
picker.hide();
|
|
const hexa = color.toHEXA().toString();
|
|
const hexa = color.toHEXA().toString();
|
|
emit("change", hexa);
|
|
emit("change", hexa);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+ watch(
|
|
|
|
+ () => props.value,
|
|
|
|
+ () => {
|
|
|
|
+ picker.setColor(props.value);
|
|
|
|
+ }
|
|
|
|
+ );
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
initPicker();
|
|
initPicker();
|
|
});
|
|
});
|
|
@@ -178,6 +187,7 @@ export const FontStyleComp = defineComponent({
|
|
const state = reactive({
|
|
const state = reactive({
|
|
isOn: props.value || false,
|
|
isOn: props.value || false,
|
|
});
|
|
});
|
|
|
|
+
|
|
const triggerStyle = () => {
|
|
const triggerStyle = () => {
|
|
state.isOn = !state.isOn;
|
|
state.isOn = !state.isOn;
|
|
emit("change", state.isOn);
|
|
emit("change", state.isOn);
|
|
@@ -236,6 +246,26 @@ export const FontSize = defineComponent({
|
|
);
|
|
);
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
+export const LinkButton = defineComponent({
|
|
|
|
+ props: {
|
|
|
|
+ icon: any(),
|
|
|
|
+ value: any(),
|
|
|
|
+ },
|
|
|
|
+ emits: ["change"],
|
|
|
|
+ setup(props, { emit }) {
|
|
|
|
+ const showLinkInput = async () => {
|
|
|
|
+ const res = await queenApi.showInput({
|
|
|
|
+ title: "请输入链接地址",
|
|
|
|
+ defaultValue: "http://",
|
|
|
|
+ });
|
|
|
|
+ emit("change", res);
|
|
|
|
+ };
|
|
|
|
+ return () => (
|
|
|
|
+ <Button type="text" icon={props.icon} onClick={showLinkInput}></Button>
|
|
|
|
+ );
|
|
|
|
+ },
|
|
|
|
+});
|
|
|
|
+
|
|
const currStyle = css`
|
|
const currStyle = css`
|
|
color: @inf-primary-color;
|
|
color: @inf-primary-color;
|
|
&:hover,
|
|
&:hover,
|