πŸ‡¬πŸ‡§United Kingdom @Jons

Account created on 10 August 2010, over 14 years ago
#

Recent comments

πŸ‡¬πŸ‡§United Kingdom Jons

Resolution of #6 seems to be to change src/ForumIndexStorage.php by adding a check for an existing record in create() and createIndex() and skipping insert if one does exist. A possible patch is attached

πŸ‡¬πŸ‡§United Kingdom Jons

I've hit a similar problem and it's just when trying to set the Promoted flag in HOOK_node_insert()
Drupal\Core\Entity\EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '897' for key 'forum.PRIMARY': INSERT INTO "forum" ("tid", "vid", "nid") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 59 [:db_insert_placeholder_1] => 897 [:db_insert_placeholder_2] => 124 ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 817 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

So this is into the main forum table rather than the index.
It could be because I'm calling save() on the node and that triggers forum's presave or insert hooks.
I have to call save() as the hook is downstream of DB update.
I also did a separate load/update/save of the node (after trying just saving the passed-in node) - same result.
Looking at the forum table the current highest vid is 896, ie no 897 present. The insert fails so both attempts to write the record presumably get thrown away.
Node revisions are switched off for this content type.
Trying to catch (and ignore) the exception does not work.

Suggest duplicate keys allowed?

πŸ‡¬πŸ‡§United Kingdom Jons

Help request - I didn't know you could paste from a docx etc, so I tried it using the test file (TextAndImgForPasteTest.docx)
I cannot get the image to be pasted/saved (I can upload images using the normal media upload route).

After paste the ckeditor source is:

<p class="western" style="line-height:100%;margin-bottom:0cm;">
    This<img src="file:///tmp/lu163963bh9t.tmp/lu163963bhcm_tmp_e67916f350c6bf59.jpg" name="Picture 3" align="bottom" width="172" height="129" border="0"> is a jpeg image
</p>

The text is present and the image is shown as a square with 'broken image' icon and 'HTML object' as a highlight.

Looking at the console it immediately shows:
Security Error: Content at https://mydomain/node/199/edit?destination=/admin/content may not load or link to file:///tmp/lu163963bh9t.tmp/lu163963bhcm_tmp_e67916f350c6bf59.jpg.

I looked in drupaldata/xxx/tmp and it shows a recent update time on tmp which may be the file trying to be saved by ckeditor?
(no new files present)

I can't see any obvious issue with perms.
Same issue with basic html as with full html
Can anyone say what should happen - I believe the image should end up in sites/default/files/inline-images?

πŸ‡¬πŸ‡§United Kingdom Jons

where should it go @avpaderno?

πŸ‡¬πŸ‡§United Kingdom Jons

Looking in composer.lock, it seems tbachert/spi is required by a new version of open-telemetry/sdk which is required by new core-dev 10.3.6

$ composer why tbachert/spi
Cannot load Xdebug - it was already loaded
open-telemetry/sdk 1.1.0 requires tbachert/spi (^1.0.1) 

$ composer why open-telemetry/sdk
Cannot load Xdebug - it was already loaded
drupal/core-dev              10.3.6 requires  open-telemetry/sdk (^1)      
open-telemetry/api           1.1.0  conflicts open-telemetry/sdk (<=1.0.8) 
open-telemetry/exporter-otlp 1.1.0  requires  open-telemetry/sdk (^1.0) 

A release note would be nice - did not see one?

πŸ‡¬πŸ‡§United Kingdom Jons

I encountered this ( https://www.drupal.org/project/drupal/issues/3477114 πŸ› .ui-dialog-buttonpane missing on media select dialog Active )

If 'Enable sticky action buttons' is on (gin.settings.yml: sticky_action_buttons: true) the buttons don't appear in various places - Views admin etc. Disabling makes them work again.

I'm on 3.0.0-rc13

If I set sticky on again and apply #29 (and clear cache) then go to edit a node with a media field, the buttons appear on the initial ('Add or select media') dialog, but disappear if you select a different directory and click Apply filters.

πŸ‡¬πŸ‡§United Kingdom Jons

Thanks for great help @wotts @idebr

It was the Sticky setting, ' Enable sticky action buttons', which was different on dev compared to live (I missed this in checking).
(In gin.settings.yml: sticky_action_buttons: true)

Switching this off makes the buttons appear again!

I'm on 3.0.0-rc13 so maybe the issue has come back.

Looking at Gin issue, if I set sticky on again and apply #29 then go to edit a node with a media field, the buttons appear on initial ('Add or select media') dialog, but disappear if you select a different directory and click Apply filters.

I'll add this to 3455080

πŸ‡¬πŸ‡§United Kingdom Jons

The dialog is related to a View: Media library Page (/admin/content/media-widget) - same layout etc. The action bar is missing from this also.
The action line is missing from the Views UI page as well!

A comparison of configsync directories between live and dev shows no differences

πŸ‡¬πŸ‡§United Kingdom Jons

I've tried to debug through this - the 'Insert selected' is added in MediaLibrarySelectForm.php
$form['actions']['submit']['#value'] = $this->t('Insert selected');

This seems to be a viewsForm field so more complex than a simple form.
The processing does a number of doBuildForm() in FormBuilder.php and at some point 'Insert selected' gets lost or relevant HTML not generated.

So any hints on tracking down would be helpful - code or config etc.

πŸ‡¬πŸ‡§United Kingdom Jons

Display modes are described here: https://www.drupal.org/docs/drupal-apis/entity-api/display-modes-view-mo... β†’
Not sure if actually a display mode should be added for history entity_type?
If so would have to be done by a config file as does not appear on /admin/structure/display-modes/form etc

πŸ‡¬πŸ‡§United Kingdom Jons

As I'm on D10, composer refused to download/install due to version conflict so I downloaded and installed from zip.

I ran the patch manually and it worked OK, however running from top level I removed the diff and index lines and added the path eg :

--- a/web/modules/contrib/forumsub/forum_subscribe.info.yml
+++ b/web/modules/contrib/forumsub/forum_subscribe.info.yml
@@ -3,7 +3,7 @@
 package: Notifications
...

etc

Please apply this to the core module soonest - so it can at least composer will work.
thanks

πŸ‡¬πŸ‡§United Kingdom Jons

jons β†’ created an issue.

πŸ‡¬πŸ‡§United Kingdom Jons

hi Rajab
thanks - worked for me

πŸ‡¬πŸ‡§United Kingdom Jons

Hi @dolszewski
Yes disabling this stops the stripping - but should there be a config to allow span to have an attribute?
With a custom tag this is possible. Would it make sense to use a custom tag?

πŸ‡¬πŸ‡§United Kingdom Jons

Jons β†’ created an issue.

πŸ‡¬πŸ‡§United Kingdom Jons

Yes @cilefen but I think most people expect the content to stay the same as the view is changed

πŸ‡¬πŸ‡§United Kingdom Jons

great, will you be doing a new release or wait a bit?

πŸ‡¬πŸ‡§United Kingdom Jons

Add section on getClientStatement()

πŸ‡¬πŸ‡§United Kingdom Jons

Jons β†’ created an issue.

πŸ‡¬πŸ‡§United Kingdom Jons

Hi @pravat231
I can't help with this as I've not had to implement that functionality.
It was certainly easier to work with CKE4!
Maybe it will get a bit better the more that is done and shared with CKE5, and the main docs updated.

πŸ‡¬πŸ‡§United Kingdom Jons

Hi @pravat231
You need to add them to the allowed tags in the text-formats you are using, eg Full HTML (admin/config/content/formats)
Click configure
If you have 'Limit allowed HTML tags and correct faulty HTML' filter enabled (as I suspect you have):
Scroll down to the 'Filter settings' area and add to the 'Allowed HTML Tags' textarea as ''
Save
Edit your page and try again.
Note that even clicking the Source button in the editor makes the filters operate (ie you don't have to save to test this).

The other option is to switch off 'Limit allowed HTML tags and correct faulty HTML' - which I currently have, to deal with a different issue.
There is a 'Correct faulty and chopped off HTML' filter as well, which can be left on.

πŸ‡¬πŸ‡§United Kingdom Jons

I used 1.0.3 which seems to be the latest

πŸ‡¬πŸ‡§United Kingdom Jons

Hi Wim - yep thanks - but could not find a plugin example with optional attributes - suggestion please?

πŸ‡¬πŸ‡§United Kingdom Jons

@wim These lines were missing. I my case changing from false to

      - <bbref>
      - <bbref ver>

as I have one attribute 'ver'

For info: to make editor pickup change: in text format - after enabling 'Limit allowed HTML tags and correct faulty HTML' filter, remove your plugin from text format, save, edit text format again and re-add.

BTW A related issue - not specifically to do with the above filter:
The attribute 'ver' is logically optional but in ckeditor5 it must be present (even as 'ver=""') otherwise ckeditor5 will not recognise the tag and removes that markup. Is there a way to configure an optional attribute?

πŸ‡¬πŸ‡§United Kingdom Jons

Now on Drupal 9.5.4
The custom tag (and others like abbr) are now being stripped off when viewed if in 'Text formats and editors', the filter 'Limit allowed HTML tags and correct faulty HTML' is enabled.

This is done by Xss::filter() in process() (core/modules/filter/src/Plugin/Filter/FilterHtml.php) as the allowed tags do not include our custom tag.
The 'restrictions' are:<br> <p> <h2> <h3> <h4> <h5> <h6> <strong> <em> <blockquote> <a href> <ul> <ol reversed start> <li> <table> <tr> <td rowspan colspan> <th rowspan colspan> <thead> <tbody> <tfoot> <caption> <img src alt height width data-entity-uuid data-entity-type data-caption data-align> <drupal-media data-entity-type data-entity-uuid alt data-caption data-align>
as shown on the configuration page but are read-only as apparently come from ckeditor. It's not stated how to set them there.

Note this filter operates on normal view not just when saving in ckeditor.

If the filter 'Limit allowed HTML tags and correct faulty HTML' is switched off the custom tag is shown correctly on view and edit - no data-ck-unsafe-element

I could not see a release note on filters or ckeditor in Drupal 9.5.4

It would be good to confirm what should happen and how to add a custom tag if you want 'Limit allowed HTML tags and correct faulty HTML' switched on.

πŸ‡¬πŸ‡§United Kingdom Jons

The above build issues were related to using the latest yarn version (v3) - yarn v1 is needed! (see https://github.com/ckeditor/ckeditor5/issues/13340).
The page https://www.drupal.org/docs/core-modules-and-themes/core-modules/ckeditor-5-module/ckeditor-5-development β†’ has been updated to note this.
I was able to do a debug build - which is complicated with all the yarn-linking but could not see exactly where this was happening.
I did a CSS work-round so the data was at least visible.

However - in 'Text formats and editors' if the filter 'Limit allowed HTML tags and correct faulty HTML' is enabled the problem goes away...
This is in core/modules/filter/src/Plugin/Filter/FilterHtml.php
Again it's not clear how this is affecting ckeditor5

πŸ‡¬πŸ‡§United Kingdom Jons

Add unlink note

πŸ‡¬πŸ‡§United Kingdom Jons

add warning to use v1 of yarn

πŸ‡¬πŸ‡§United Kingdom Jons

git@github .. gives:

git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

so https:... more convenient

πŸ‡¬πŸ‡§United Kingdom Jons

Hi Wim
Tried that:

$ yarn cache clean
➀ YN0000: Done in 0s 1ms
jon@nat:/var/www/ktt/web/core$ yarn build:ckeditor5-dev
Internal Error: Drupal@workspace:.: This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile
    at Cb.getCandidates (/home/jon/.cache/node/corepack/yarn/3.3.1/yarn.js:435:5146)
    at zf.getCandidates (/home/jon/.cache/node/corepack/yarn/3.3.1/yarn.js:391:1264)
    at /home/jon/.cache/node/corepack/yarn/3.3.1/yarn.js:439:7695
    at Ff (/home/jon/.cache/node/corepack/yarn/3.3.1/yarn.js:390:8965)
    at ge (/home/jon/.cache/node/corepack/yarn/3.3.1/yarn.js:439:7675)
    at async Promise.allSettled (index 0)
    at async eo (/home/jon/.cache/node/corepack/yarn/3.3.1/yarn.js:390:8293)
    at async /home/jon/.cache/node/corepack/yarn/3.3.1/yarn.js:439:8205
    at async ni.startProgressPromise (/home/jon/.cache/node/corepack/yarn/3.3.1/yarn.js:390:45507)
    at async He.resolveEverything (/home/jon/.cache/node/corepack/yarn/3.3.1/yarn.js:439:6238)


$ yarn install
➀ YN0000: β”Œ Resolution step
➀ YN0013: β”‚ farbtastic@https://github.com/mattfarina/farbtastic/archive/1.3u.tar.gz can't be found in the cache and will be fetched from the remote server
➀ YN0013: β”‚ joyride@https://github.com/zurb/joyride/archive/refs/heads/v2.1.tar.gz can't be found in the cache and will be fetched from the remote server
➀ YN0061: β”‚ picturefill@npm:3.0.3 is deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
➀ YN0032: β”‚ fsevents@npm:2.3.2: Implicit dependencies on node-gyp are discouraged
➀ YN0061: β”‚ request@npm:2.88.2 is deprecated: request has been deprecated, see https://github.com/request/request/issues/3142

➀ YN0001: β”‚Error: farbtastic@https://github.com/mattfarina/farbtastic/archive/1.3u.tar.gz: Manifest not found
    at el.find (/home/jon/.cache/node/corepack/yarn/3.3.1/yarn.js:390:29961)
    at async /home/jon/.cache/node/corepack/yarn/3.3.1/yarn.js:601:11496
    at async Object.Gbe (/home/jon/.cache/node/corepack/yarn/3.3.1/yarn.js:390:8896)
    at async yQ.resolve (/home/jon/.cache/node/corepack/yarn/3.3.1/yarn.js:601:11457)
    at async zf.resolve (/home/jon/.cache/node/corepack/yarn/3.3.1/yarn.js:391:1400)
    at async zf.resolve (/home/jon/.cache/node/corepack/yarn/3.3.1/yarn.js:391:1400)
    at async /home/jon/.cache/node/corepack/yarn/3.3.1/yarn.js:439:6346
    at async Ff (/home/jon/.cache/node/corepack/yarn/3.3.1/yarn.js:390:8959)
    at async Z (/home/jon/.cache/node/corepack/yarn/3.3.1/yarn.js:439:6328)
    at async Promise.allSettled (index 43)
➀ YN0000: β”” Completed in 2s 892ms
➀ YN0000: Failed with errors in 2s 896ms
➀ YN0061: request-promise@npm:4.2.6 is deprecated: request-promise has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
➀ YN0061: debug@npm:3.2.6 is deprecated: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
➀ YN0061: mkdirp@npm:0.5.4 is deprecated: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
➀ YN0061: har-validator@npm:5.1.5 is deprecated: this library is no longer supported
➀ YN0061: uuid@npm:3.4.0 is deprecated: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
➀ YN0061: @npmcli/move-file@npm:2.0.1 is deprecated: This functionality has been moved to @npmcli/fs

I've tried related actions with npm and get similar problems with farbtastic, also if trying to add packages in package.json manually

πŸ‡¬πŸ‡§United Kingdom Jons

Wim, yes looks like I'll need to debug the Drupal setup - could you advise easiest way to build a 'source' version of web/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js with same loaders etc? package.json, webpack.config.js are obviously not in the core area.

I guess along these lines https://ckeditor.com/docs/ckeditor5/latest/installation/advanced/alterna...

πŸ‡¬πŸ‡§United Kingdom Jons

I created a standalone version of the plugin with local paths (ie so runs like one of the example plugins) (uploaded to github issue). This works fine so the issue seems to be something to do with the Drupal environment? Both are running the same version of CKE (34.2.0) according to window.CKEDITOR_VERSION

Looking at unminified ckeditor5-dll.js it seems to be evaluated in cjs.js which is passed various rules:

                "./node_modules/css-loader/dist/cjs.js!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].use[2]!./packages/ckeditor5-engine/theme/renderer.css": (e, t, o) => {
                    "use strict";
                    o.d(t, { Z: () => n });
                    var s = o("./node_modules/css-loader/dist/runtime/api.js"),
                        i = o.n(s)()(function (e) {
                            return e[1];
                        });
                    i.push([e.id, ".ck.ck-editor__editable span[data-ck-unsafe-element]{display:none}", ""]);
                    const n = i;
                },

This seems to be in one of the loaders as not in core ckeditor5 source on github, from what I can see (https://github.com/ckeditor)

πŸ‡¬πŸ‡§United Kingdom Jons

BTW Working through the ckeditor sample plugins, all the code is local in node_modules etc
When transferring to running under drupal the structure is not the same.
I worked out the import path changes.
I can see ckeditor5-dll.js in core/assets/... and the plugins in core/modules/ckeditor5/js/ckeditor5_plugins
Also clues in core/modules/ckeditor5/js/build/ckeditor5.types.jsdoc
But could full structure be documented please to help with debugging?

Production build 0.71.5 2024