From 712a07c39b6c4266c729f796b54809f6fc1aff0f Mon Sep 17 00:00:00 2001 From: Keegan George Date: Tue, 22 Oct 2024 06:48:10 +0900 Subject: [PATCH] DEV: `IMAGE_MARKDOWN_REGEX` import available in core (#847) --- .discourse-compatibility | 2 +- assets/javascripts/discourse/lib/utilities.js | 3 --- .../javascripts/discourse/services/image-caption-popup.js | 2 +- assets/javascripts/initializers/ai-image-caption.js | 7 +++++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.discourse-compatibility b/.discourse-compatibility index 153628c3..cced5d45 100644 --- a/.discourse-compatibility +++ b/.discourse-compatibility @@ -1,4 +1,4 @@ -< 3.4.0.beta3-dev: ecf1bb49d737ea15308400f22f89d1d1e71d13d +< 3.4.0.beta3-dev: decf1bb49d737ea15308400f22f89d1d1e71d13d < 3.4.0.beta1-dev: 9d887ad4ace8e33c3fe7dbb39237e882c08b4f0b < 3.3.0.beta5-dev: 4d8090002f6dcd8e34d41033606bf131fa221475 < 3.3.0.beta2-dev: 61890b667c06299841ae88946f84a112f00060e1 diff --git a/assets/javascripts/discourse/lib/utilities.js b/assets/javascripts/discourse/lib/utilities.js index c4f1e7af..840a2496 100644 --- a/assets/javascripts/discourse/lib/utilities.js +++ b/assets/javascripts/discourse/lib/utilities.js @@ -1,9 +1,6 @@ import { htmlSafe } from "@ember/template"; import { escapeExpression } from "discourse/lib/utilities"; -export const IMAGE_MARKDOWN_REGEX = - /!\[(.*?)\|(\d{1,4}x\d{1,4})(,\s*\d{1,3}%)?(.*?)\]\((upload:\/\/.*?)\)(?!(.*`))/g; - export function jsonToHtml(json) { if (json === null) { return "null"; diff --git a/assets/javascripts/discourse/services/image-caption-popup.js b/assets/javascripts/discourse/services/image-caption-popup.js index 2619acf6..ef3b01bd 100644 --- a/assets/javascripts/discourse/services/image-caption-popup.js +++ b/assets/javascripts/discourse/services/image-caption-popup.js @@ -1,6 +1,6 @@ import { tracked } from "@glimmer/tracking"; import Service, { inject as service } from "@ember/service"; -import { IMAGE_MARKDOWN_REGEX } from "../lib/utilities"; +import { IMAGE_MARKDOWN_REGEX } from "discourse/lib/uploads"; export default class ImageCaptionPopup extends Service { @service composer; diff --git a/assets/javascripts/initializers/ai-image-caption.js b/assets/javascripts/initializers/ai-image-caption.js index 245da8a7..9963e94a 100644 --- a/assets/javascripts/initializers/ai-image-caption.js +++ b/assets/javascripts/initializers/ai-image-caption.js @@ -1,9 +1,12 @@ import { ajax } from "discourse/lib/ajax"; import { extractError, popupAjaxError } from "discourse/lib/ajax-error"; import { apiInitializer } from "discourse/lib/api"; -import { getUploadMarkdown, isImage } from "discourse/lib/uploads"; +import { + getUploadMarkdown, + IMAGE_MARKDOWN_REGEX, + isImage, +} from "discourse/lib/uploads"; import I18n from "discourse-i18n"; -import { IMAGE_MARKDOWN_REGEX } from "../discourse/lib/utilities"; export default apiInitializer("1.25.0", (api) => { const buttonAttrs = {