Allow Editing Code Blocks When Editing Posts

554
5
02-10-2024 10:51 PM
Status: Closed
MErikReedAugusta
Occasional Contributor III

Let's say I put a code block in a post like so:

def Main():
  print(hello

if __name__ == '__main__':
  Main()

 Oh, whoops, a typo!  I forgot the parenthesis after "hello" on line 2.  Or sometimes I realize I didn't word a comment clearly enough, or I forgot to include some piece of code.

But I can't edit a code block once it's embedded.  I have to select it, delete it, and start again.

Sure, I can do copy/paste with the code in the code block to speed the process slightly, but it's still a pain.  Why not allow users to hit an edit button on that code block and pull that dialog back up to make their changes?

Tags (2)
5 Comments
DanPatterson
def Main():
  print(hello) ## oops

if __name__ == '__main__':
  Main()

so this procedure isn't working

editcode.png

KenBuja

Sometimes I can double click on the code block to open up the editing dialog, but more often, as @DanPatterson mentions, I have to click on the code block, then click the "Insert/Edit code sample" button to begin editing it.

JesseCloutier

Hi @MErikReedAugusta, per @DanPatterson and @KenBuja, we've also tested the editing process by double-clicking the code block and doing a single click to select > use the code feature. These both worked on our end, though we note that there seems to be an inconsistent experience referenced when it comes to the double-click method. Because there is a way to do this, I'm going to close this idea but am tagging @SimiBasu for visibility in advance of an update we anticipate for the Esri Community platform later this year that's expected to improve the post editor.

JesseCloutier
Status changed to: Closed
 
MErikReedAugusta

Ah, I hadn't stumbled upon either of those methods.  I'll start giving them a shot.

Thanks, all!