diff --git a/CHANGELOG.md b/CHANGELOG.md index b6ddd3f1f864cbcc75d42594be90f6f42970c45d..0f11b523cb90f1ca7ac96e4891d426d78d033d17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +* `caosdb-v-property-linkified` css class to denote properties that have been + linkified already. + ### Changed (for changes in existing functionality) ### Deprecated @@ -16,29 +19,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +* [#199](https://gitlab.com/caosdb/caosdb-webui/-/issues/199) - Linkify creates + additional links after showing previews of referenced entities + ### Security ### Documentation ## [0.10.1] - 2023-02-14 -### Added - -### Changed (for changes in existing functionality) - -### Deprecated - -### Removed - ### Fixed * [#194](https://gitlab.com/caosdb/caosdb-webui/-/issues/194) - Properties remain hidden in previews of referenced entities -### Security - -### Documentation - ## [0.10.0] - 2022-12-19 (Florian Spreckelsen) diff --git a/src/core/js/ext_cosmetics.js b/src/core/js/ext_cosmetics.js index 77556437394df6a6763661ce5c0d5001f68ce61a..da05f294f2022a469e74ec05d64211fe1f8b26b7 100644 --- a/src/core/js/ext_cosmetics.js +++ b/src/core/js/ext_cosmetics.js @@ -1,8 +1,9 @@ /* * This file is a part of the CaosDB Project. * - * Copyright (C) 2021 IndiScale GmbH <info@indiscale.com> + * Copyright (C) 2021-2023 IndiScale GmbH <info@indiscale.com> * Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com> + * Copyright (C) 2023 Florian Spreckelsen <f.spreckelsen@indiscale.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -37,7 +38,7 @@ var cosmetics = new function () { var _linkify = function () { $('.caosdb-f-property-text-value').each(function (index) { - if (/https?:\/\//.test(this.innerText)) { + if (!($(this).hasClass("caosdb-v-property-linkified")) && (/https?:\/\//.test(this.innerText))) { var result = this.innerText.replace(/https?:\/\/[^\s]*/g, function (href, index) { var link_text = href; if (_link_cut_off_length > 4 && link_text.length > _link_cut_off_length) { @@ -47,6 +48,9 @@ var cosmetics = new function () { return `<a title="Open ${href} in a new tab." target="_blank" class="caosdb-v-property-href-value" href="${href}">${link_text} <i class="bi bi-box-arrow-up-right"></i></a>`; }); + // add class to highlight that this has been linkified already + // (see https://gitlab.com/caosdb/caosdb-webui/-/issues/199). + $(this).addClass("caosdb-v-property-linkified") $(this).hide(); $(this).after(result); } @@ -80,4 +84,4 @@ var cosmetics = new function () { $(document).ready(function () { caosdb_modules.register(cosmetics); -}); \ No newline at end of file +});