Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into feat/adapt-uc
Browse files Browse the repository at this point in the history
  • Loading branch information
ruibaby committed May 6, 2024
2 parents a0c3923 + e591d3d commit f1e89f4
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 136 deletions.
127 changes: 0 additions & 127 deletions .github/workflows/build.yml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: CD

on:
release:
types:
- published

jobs:
cd:
uses: halo-sigs/reusable-workflows/.github/workflows/plugin-cd.yaml@v1
secrets:
halo-username: ${{ secrets.HALO_USERNAME }}
halo-password: ${{ secrets.HALO_PASSWORD }}
permissions:
contents: write
with:
app-id: app-SnwWD
ui-path: "console"
15 changes: 15 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
ci:
uses: halo-sigs/reusable-workflows/.github/workflows/plugin-ci.yaml@v1
with:
ui-path: "console"
12 changes: 9 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,19 @@ node {
nodeProjectDir = file("${project.projectDir}/console")
}

task buildFrontend(type: PnpmTask) {
tasks.register('installDepsForUI', PnpmTask) {
args = ['install']
}

tasks.register('buildFrontend', PnpmTask) {
args = ['build']
dependsOn('installDepsForUI')
}

build {
// build frontend before build
tasks.getByName('compileJava').dependsOn('buildFrontend')
tasks.named('compileJava').configure {
dependsOn('buildFrontend')
}
}

halo {
Expand Down
2 changes: 1 addition & 1 deletion console/src/components/PreviewDetailModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const onVisibleChange = (visible: boolean) => {
class="overflow-hidden bg-white moments-flex moments-items-center moments-justify-center moments-h-full"
>
<template v-if="props.media.type === 'PHOTO'">
<img :src="media?.url" class="moments-w-auto" />
<img :src="media?.url" class="moments-w-auto moments-h-full" />
</template>
<template v-else-if="props.media.type === 'VIDEO'">
<video controls muted :src="media?.url">
Expand Down
8 changes: 4 additions & 4 deletions console/src/components/TextEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ import {
ExtensionDropcursor,
ExtensionGapcursor,
ExtensionHardBreak,
ExtensionHeading,
ExtensionHistory,
ExtensionHorizontalRule,
ExtensionItalic,
ExtensionOrderedList,
ExtensionStrike,
ExtensionText,
ExtensionImage,
ExtensionTaskList,
ExtensionLink,
ExtensionTextAlign,
Expand All @@ -42,11 +40,13 @@ import {
ExtensionTrailingNode,
useEditor,
ExtensionListKeymap,
ExtensionParagraph,
} from "@halo-dev/richtext-editor";
import { watch } from "vue";
import { TagsExtension } from "@/extensions/tags";
import type { useTagQueryFetchProps } from "@/composables/use-tag";
import type { UseQueryReturnType } from "@tanstack/vue-query";
import MomentExtensionImage from "@/extensions/images";
const props = withDefaults(
defineProps<{
Expand Down Expand Up @@ -74,6 +74,7 @@ const emit = defineEmits<{
const editor = useEditor({
content: props.raw,
extensions: [
ExtensionParagraph,
ExtensionBlockquote,
ExtensionBold,
ExtensionBulletList,
Expand All @@ -86,14 +87,13 @@ const editor = useEditor({
}),
ExtensionGapcursor,
ExtensionHardBreak,
ExtensionHeading,
ExtensionHistory,
ExtensionHorizontalRule,
ExtensionItalic,
ExtensionOrderedList,
ExtensionStrike,
ExtensionText,
ExtensionImage.configure({
MomentExtensionImage.configure({
inline: true,
allowBase64: false,
HTMLAttributes: {
Expand Down
41 changes: 41 additions & 0 deletions console/src/extensions/images/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { Editor, ExtensionImage, type Range } from "@halo-dev/richtext-editor";
import type { ExtensionOptions } from "@halo-dev/richtext-editor/dist/types";
import { markRaw } from "vue";
import MdiFileImageBox from "~icons/mdi/file-image-box";

export interface ImageOptions {
inline: boolean;
allowBase64: boolean;
HTMLAttributes: Record<string, unknown>;
}

const MomentExtensionImage = ExtensionImage.extend<
ExtensionOptions & ImageOptions
>({
addOptions() {
return {
...this.parent?.(),
getCommandMenuItems() {
return {
priority: 100,
icon: markRaw(MdiFileImageBox),
title: "图片",
keywords: ["image", "tupian"],
command: ({ editor, range }: { editor: Editor; range: Range }) => {
editor
.chain()
.focus()
.deleteRange(range)
.insertContent([
{ type: "image", attrs: { src: "" } },
{ type: "paragraph", content: "" },
])
.run();
},
};
},
};
},
});

export default MomentExtensionImage;
3 changes: 2 additions & 1 deletion src/main/java/run/halo/moments/MomentsPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.Set;
import org.apache.commons.lang3.BooleanUtils;
import org.springframework.stereotype.Component;
import run.halo.app.extension.Scheme;
import run.halo.app.extension.SchemeManager;
import run.halo.app.extension.index.IndexSpec;
import run.halo.app.plugin.BasePlugin;
Expand Down Expand Up @@ -76,6 +77,6 @@ public void start() {

@Override
public void stop() {
schemeManager.unregister(schemeManager.get(Moment.class));
schemeManager.unregister(Scheme.buildFromType(Moment.class));
}
}

0 comments on commit f1e89f4

Please sign in to comment.