Instead of stacking elements vertically in rows, we use an hbox layout, which arranges the child elements horizontally (in a single row). hbox is CKEditor's way of arranging elements in a horizontal...
Equal width columns except the last one, using flex in CSS
13 Sep, 2024
To create CSS flex columns with equal width except for the last one, you can use this combination of flexbox properties.
Append to HTML with JavaScript
13 Sep, 2024
To append content to an HTML element using JavaScript, you can use appendChild() for DOM elements or innerHTML for strings.
JSHint: Expected an identifier and instead saw ']'.(E030)
6 Sep, 2024
The JSHint error "Expected an identifier and instead saw ']'. (E030)" usually occurs when there is a syntax issue in your JavaScript code involving square brackets ([]). The least obvious is that you...
CKEditor 4: Add edit button to context menu
6 Sep, 2024
This code snippet adds a custom "Edit" button to the CKEditor context menu, specifically for a widget with the class "my-widget." It first creates a new menu group called myWidgetGroup and then...
CKEditor 4: Save dialog form data/state
6 Sep, 2024
The example contains a CKEditor 4 widget with a dialog that allows users to edit widget properties. The dialog loads existing widget data into form fields. When the dialog is submitted, the form data...
Flex 100% width in CSS for a row
6 Sep, 2024
To set a flex container with flex-direction: row and ensure it takes up 100% width, you can do it like in this snippet. With flex-direction: row, the flex items (the children) will be aligned in a...
Preact update state on resize event
22 Aug, 2024
You can create a Preact component that rerenders every time the window is resized by using window.addEventListener('resize'). The general approach involves setting up an event listener in a useEffect...
Parse Url in JavaScript
22 Aug, 2024
To parse a URL in JavaScript, you can use the built-in URL object. This provides an easy way to extract and manipulate different parts of a URL.
Preact: Add delay to updating a string
22 Aug, 2024
To add a delay to updating a string based on state in Preact, you can use the useEffect hook in combination with setTimeout. This allows you to delay the state update by a certain amount of time...