enhance(frontend): improve plugin management
This commit is contained in:
@@ -222,7 +222,7 @@ import { isEnabledUrlPreview } from '@/instance.js';
|
||||
import { focusPrev, focusNext } from '@/utility/focus.js';
|
||||
import { getAppearNote } from '@/utility/get-appear-note.js';
|
||||
import { prefer } from '@/preferences.js';
|
||||
import { noteViewInterruptors } from '@/plugin.js';
|
||||
import { getPluginHandlers } from '@/plugin.js';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
note: Misskey.entities.Note;
|
||||
@@ -248,6 +248,7 @@ const currentClip = inject<Ref<Misskey.entities.Clip> | null>('currentClip', nul
|
||||
const note = ref(deepClone(props.note));
|
||||
|
||||
// plugin
|
||||
const noteViewInterruptors = getPluginHandlers('note_view_interruptor');
|
||||
if (noteViewInterruptors.length > 0) {
|
||||
onMounted(async () => {
|
||||
let result: Misskey.entities.Note | null = deepClone(note.value);
|
||||
|
@@ -254,7 +254,7 @@ import MkButton from '@/components/MkButton.vue';
|
||||
import { isEnabledUrlPreview } from '@/instance.js';
|
||||
import { getAppearNote } from '@/utility/get-appear-note.js';
|
||||
import { prefer } from '@/preferences.js';
|
||||
import { noteViewInterruptors } from '@/plugin.js';
|
||||
import { getPluginHandlers } from '@/plugin.js';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
note: Misskey.entities.Note;
|
||||
@@ -268,6 +268,7 @@ const inChannel = inject('inChannel', null);
|
||||
const note = ref(deepClone(props.note));
|
||||
|
||||
// plugin
|
||||
const noteViewInterruptors = getPluginHandlers('note_view_interruptor');
|
||||
if (noteViewInterruptors.length > 0) {
|
||||
onMounted(async () => {
|
||||
let result: Misskey.entities.Note | null = deepClone(note.value);
|
||||
|
@@ -136,7 +136,7 @@ import { claimAchievement } from '@/utility/achievements.js';
|
||||
import { emojiPicker } from '@/utility/emoji-picker.js';
|
||||
import { mfmFunctionPicker } from '@/utility/mfm-function-picker.js';
|
||||
import { prefer } from '@/preferences.js';
|
||||
import { notePostInterruptors, postFormActions } from '@/plugin.js';
|
||||
import { getPluginHandlers } from '@/plugin.js';
|
||||
|
||||
const $i = signinRequired();
|
||||
|
||||
@@ -197,6 +197,7 @@ const showingOptions = ref(false);
|
||||
const textAreaReadOnly = ref(false);
|
||||
const justEndedComposition = ref(false);
|
||||
const renoteTargetNote: ShallowRef<PostFormProps['renote'] | null> = shallowRef(props.renote);
|
||||
const postFormActions = getPluginHandlers('post_form_action');
|
||||
|
||||
const draftKey = computed((): string => {
|
||||
let key = props.channel ? `channel:${props.channel.id}` : '';
|
||||
@@ -823,6 +824,7 @@ async function post(ev?: MouseEvent) {
|
||||
}
|
||||
|
||||
// plugin
|
||||
const notePostInterruptors = getPluginHandlers('note_post_interruptor');
|
||||
if (notePostInterruptors.length > 0) {
|
||||
for (const interruptor of notePostInterruptors) {
|
||||
try {
|
||||
|
Reference in New Issue
Block a user