ContentTools
ContentTools copied to clipboard
Fixtures shouldn't allow shift+enter to create new paragraphs
I want to create single only editable element. I already set ContentEdit.PREFER_LINE_BREAKS to true;
But if user press Shift+Enter, he can anyway create another block, wrapped into p tag. It breaks selections, it requires a p tag styling etc.
How can i make Shift+Enter acts same as Enter? Or completely disable it?
@koutsenko it sounds like you want to use fixtures:
<div data-fixture data-ce-tag="p">
Enter content...
</div>
@anthonyjb , sorry for delay. I tried to add data-fixture attribute both to parent div and content p tag, and added test function to init method. Still can add new p tag via shift+enter. Where can i read docs about fixtures? Thanks.
Can you use the following example to add a fixture (and make sure you're on the latest release):
<a
data-ce-tag="p"
data-fixture
data-name="my-button"
href="/test"
class="button"
>
CLICK HERE!!!
</a>
If you can still insert new paragraphs using shift+enter then that would be a bug.
OK That's not the intended behaviour - I'll mark this up as a bug. Thanks for the flagging :+1:
And please document it clearly somewhere ... Nothing about it in docs..
@koutsenko agreed fixtures were added late on and are currently undocumented.
shift+enter don't add a new paragraph actually, but it create a line break
To me, it sound as a normal behavior, (it's possible you want to use line break in a fixture).
If you want to prevent line break in fixture, you could do something like that in CSS :
[data-fixture] br { display:none; }
Should do the job