Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMS-26944-Link-Balloon-closes-during-drag-and-drop #200

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/plugin-transform-runtime": "^7.25.4",
"@ckeditor/ckeditor5-dev-translations": "^43.0.1",
"@ckeditor/ckeditor5-dev-utils": "^43.0.1",
"@ckeditor/ckeditor5-dev-translations": "^45.0.8",
"@ckeditor/ckeditor5-dev-utils": "^45.0.8",
"@ckeditor/ckeditor5-inspector": "^4.1.0",
"@ckeditor/ckeditor5-theme-lark": "43.3.1",
"@types/node": "^20.14.10",
Expand Down
24 changes: 14 additions & 10 deletions app/webpack.config.cjs → app/webpack.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,28 @@

/* eslint-env node */

const path = require("path");
const webpack = require("webpack");
const { bundler, loaders } = require("@ckeditor/ckeditor5-dev-utils");
const { CKEditorTranslationsPlugin } = require("@ckeditor/ckeditor5-dev-translations");
const TerserPlugin = require("terser-webpack-plugin");
const CircularDependencyPlugin = require("circular-dependency-plugin");
const { default: path } = await import("path");
const { default: webpack } = await import("webpack");
const { bundler, loaders } = await import("@ckeditor/ckeditor5-dev-utils");
const { CKEditorTranslationsPlugin } = await import("@ckeditor/ckeditor5-dev-translations");
const { default: TerserPlugin } = await import("terser-webpack-plugin");
const { default: CircularDependencyPlugin } = await import("circular-dependency-plugin");
import { fileURLToPath } from "url";

module.exports = {
const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);

export default {
devtool: "source-map",
performance: { hints: false },

entry: path.resolve(__dirname, "src", "index.ts"),
entry: path.resolve(dirname, "src", "index.ts"),

output: {
// The name under which the editor will be exported.
library: "ClassicEditor",

path: path.resolve(__dirname, "dist"),
path: path.resolve(dirname, "dist"),
filename: "ckeditor.js",
libraryTarget: "umd",
libraryExport: "default",
Expand Down Expand Up @@ -57,7 +61,7 @@ module.exports = {
rules: [
loaders.getIconsLoader({ matchExtensionOnly: true }),
loaders.getStylesLoader({
themePath: require.resolve("@ckeditor/ckeditor5-theme-lark"),
themePath: import.meta.resolve("@ckeditor/ckeditor5-theme-lark"),
minify: true,
}),
loaders.getTypeScriptLoader(),
Expand Down
19 changes: 14 additions & 5 deletions packages/ckeditor5-coremedia-link/src/contentlink/ContentLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export default class ContentLinks extends Plugin {
readonly #logger = LoggerProvider.getLogger("ContentLinks");
#serviceRegisteredSubscription: Pick<Subscription, "unsubscribe"> | undefined = undefined;
#initialized = false;
#currentWorkAreaService: WorkAreaService | undefined = undefined;
#activeEntity: string | undefined = "";

/**
* Closes the contextual balloon whenever a new active entity is set.
Expand All @@ -40,10 +42,14 @@ export default class ContentLinks extends Plugin {
*/
#listenForActiveEntityChanges(workAreaService: WorkAreaService): void {
workAreaService.observe_activeEntity().subscribe({
next: (activeEntities) => {
this.#logger.debug("Closing balloon because active entity changed", activeEntities);
next: (activeEntity) => {
if (this.#activeEntity === activeEntity) {
return;
}
this.#logger.debug("Closing balloon because active entity changed", activeEntity);
this.#removeEditorFocusAndSelection();
closeContextualBalloon(this.editor);
this.#activeEntity = typeof activeEntity === "string" ? activeEntity : undefined;
},
});
}
Expand Down Expand Up @@ -86,12 +92,15 @@ export default class ContentLinks extends Plugin {
this.#logger.debug("No WorkAreaService registered yet");
return;
}
if (this.#currentWorkAreaService && services.includes(this.#currentWorkAreaService)) {
return;
}
if (this.#serviceRegisteredSubscription) {
this.#serviceRegisteredSubscription.unsubscribe();
}
this.#logger.debug("WorkAreaService is registered now, listening for activeEntities will be started");
const clipboardService = services[0];
this.#listenForActiveEntityChanges(clipboardService);
this.#logger.debug("WorkAreaService is registered now, listening for activeEntity will be started");
this.#currentWorkAreaService = services[0];
this.#listenForActiveEntityChanges(this.#currentWorkAreaService);
};
this.#serviceRegisteredSubscription = serviceAgent
.observeServices<WorkAreaService>(createWorkAreaServiceDescriptor())
Expand Down
Loading
Loading