You need to be logged in to post in the forum - Log In

An active JCE Pro Subscription is required to post in the forum - Buy a Subscription

Support is currently Offline

Official support hours
Monday to Friday
09:00 - 17:00 Europe/London (BST)

Please create a new Ticket and we will get back to you as soon as we can.

#116669 Plugin "CodeSample" - can not edit

Posted in ‘Editor’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Latest post by hing on Monday, 03 March 2025 15:09 GMT

hing

Hi Ryan

with Joomla 4.4.4 and JCE PRO 2.9.72 and Codesample 1.10 I tried this code

<p>&nbsp;</p>
<pre class="language-markup"><code>a sd dfgdf dfg</code></pre>
<p>&nbsp;</p>
<pre class="language-javascript"><code>hsfgdhfh</code></pre>
Der folgende Überblick versucht, zu diversen&nbsp; / speziellen Dateiformaten die
<p>&nbsp;</p>
<pre class="language-markup"><code>html</code></pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
<pre class="language-css"><code>css</code></pre>
<p>&nbsp;</p>

and could not edit the entries. The mouse cursor always jumps to the left and blinks on two places:

Can you reproduce it?

 

Addendum: The "undo" command of JCE does not handle this plugin. I never thought about this - is this usual?

Attachments

Ryan

and could not edit the entries. The mouse cursor always jumps to the left and blinks on two places:

Can you reproduce it?

I can reproduce this and I am investigating, however CodeSample code can only be edited in the CodeSample dialog. Click on the code in the editor to select it. Even with the cursor issue the code block will be highlighted with a blue border. Now click on the CodeSample button to open the dialog, edit the code and click update.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

hing

Hi Ryan

exactly that is the problem: "Click on the code in the editor to select it."

It is not selected ..

I use FF 126.0 on Win10 German, and also the "debug mode" ? - don't know the english word, but all plugins are deactivated) I see the same problem. See attachment:

 

Attachments

Ryan

Please send me a login - https://www.joomlacontenteditor.net/contact/site-login

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

hing

Hi Ryan

because a can't send you a login to my internal page I tried to upload the source-code on your site, but I was blocked.

Cloudflare Ray ID: 88a483d748ab4c4a

Peter

 

Edit:
Same problem with "Edit" in MSEdge.

Ryan

Please try Code Sample 1.2.0 - https://www.joomlacontenteditor.net/downloads/plugins/code-sample

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

hing

I installed version 1.2.0 and can see the new options for Prism and the new feature "line numbers", but still:

- no way to edit

- no display of the line-numbers

here is the code example:

<p>&nbsp;</p>
<pre class="line-numbers language-json"><code class="language-json">a
b
c</code></pre>
a
<p>&nbsp;</p>
<p>&nbsp;</p>
<pre class="line-numbers language-markup"><code class="language-markup">a
b
c</code></pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
<pre class="language-markup"><code class="language-markup">That's a test</code></pre>
<p>&nbsp;</p>
<p>b</p>

 

Does it depend on missing access-rights? I can install the plugin, but I have no access to CSS and that stuff ..

Ryan

This sounds like the Prism script and css files are not loading on your site.

I can't confirm this without seeing it for myself.

Can you try a different browser? Perhaps a browser extension you have installed is causing the issue.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

Ryan

I have installed CodeSample 1.2.0 on the demo site. Are you still having issues on the demo site? - https://demo.joomlacontenteditor.net/

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

hing

On MS Edge it does not work either, neither 1.1. nor 1.2.

On both browsers I can see the "Stop-Icon" beside the mouse only very shortly.

On your demo side it works as expected; I see the icon longer. But the "Update" function removes the line-numbers, although it is activated.

Ryan

On MS Edge it does not work either, neither 1.1. nor 1.2.

On both browsers I can see the "Stop-Icon" beside the mouse only very shortly.

If you insert some HTML code (with HTML tags, eg: <p>Text</p>) and select the HTML option in the Code Sample dialog, is the code in the editor highlighted (tags are coloured red)?

Please post a screenshot.

In the browser console, do you see the message "Prism successfully loaded"?

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

hing

Here are the screenshots from dialogue and from the settings I found.

In the browser console, do you see the message "Prism successfully loaded"?

Hmh - in which situation?

Attachments

Ryan

In the browser console, do you see the message "Prism successfully loaded"?

Hmh - in which situation?

In Firefox go to Tools -> Browser Tools -> Web Developer Tools and click the Console tab.

Load the editor. You should see a message in the Console - "Prism successfully loaded".

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

hing

Yes, it is loaded:

[CODE REMOVED BY ADMIN]

Ryan

No, I am referring to this:

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

hing

Yes - me too:

 

Attachments

hing

Same problem also with version 1.2.1

hing

I tried it again on your test-site here
and saw that the "line numbers" are

- displayed in "Editor mode"
- not displayed in "Preview" and in final result

 Edit:
The code looks like this:

<pre class="line-numbers language-sql"><code class="language-sql">
Is it OK that both PRE and CODE are defined with same attrib?

Ryan

Please try CodeSample 2.0.0 Beta - https://www.joomlacontenteditor.net/downloads/plugins/development/editor-codesample-dev

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

hing

Hi Ryan

thanks for the file. I tried it, found the new settings for the "copy - Button", tried the settings with and without "prism-assets" - and failed. I see no line numbers, no copy button, can not select the code-sample. See attached screencast.

Edit: Maybe something with the "prism"-stuff (???) is not OK on my side? I don't know what it is and how to check ..

Attachments

Ryan

In Editor Profiles -> Plugin Parameters -> CodeSample, set Use Custom Prism Assets to No.

In System -> Manage -> Plugins -> Code Sample, set Load Prism Assets to Yes if you want to use the Copy to Clipboard option.

The Editor Preview tab will not show a preview of the the code block, it is only available in the front-end article.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

hing

Small progress ..

I made the settings above and created this code:

<pre class="line-numbers language-sql" data-prismjs-copy="Copy to Clipboard"><code class="language-sql">select *
from xx
where w > 1</code></pre>

hing

to be continued ..

I added the code above in this forum posting and could not add text at the end of the code. This is why I write this second posting.

The code above ..

a) Does not show any line numbers in editor, preview and neither in frontend

b) Can not be selected and modified in Editor

c) In Frontend it creates the "Copy-Button" in my language (German) and works fine fine. But small cosmetics ... it confirms with "Copied" and not in German, and after some seconds it jumps back to "Copy to clipboard" and not to German.

Ryan

Please try CodeSample 2.0.0 Beta 2 - https://www.joomlacontenteditor.net/downloads/plugins/development/editor-codesample-dev

a) Does not show any line numbers in editor, preview and neither in frontend

The editor Preview tab does not display processed code blocks using the Prism library. This is only available in the front-end.

If line numbers are missing this suggests a custom version of Prism is being loaded that does not include the Line Numbers Prism plugin.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

hing

Test with Code sample here in forum:

select *
from x
where y > z

hing

The "Copy-toClipboard" button and labeling works fine, but every other topic is unchanged. Can you create a posting like the one above and continue to write behind the SQL code? It seems that there is no place for the cursor behind the <pre>

Ryan

This beta of Code Sample is available to test on the demo site - https://demo.joomlacontenteditor.net

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

hing

on demo site:

- the line numbers are OK

- the copy button is OK

- the code-block can not be selected and modified

- if the code block is on the end of the text you can not continue at the end, using the mouse. I have to click before the block and have to use the "cursor - right" to go "through the block" to the end of the bodyy.

Ryan

- the code-block can not be selected and modified

The code block cannot be edited directly. You must select it by clicking on it, then open the CodeSample dialog to edit the code.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

hing

OK, thanks. Then it's OK for me, and maybe a documentation with all the settings and behaviour would be helpful for others too.