Skip to content

Commit

Permalink
editorjs focus
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinDev committed Feb 20, 2021
1 parent 3f79cf9 commit aad4d03
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 38 deletions.
2 changes: 1 addition & 1 deletion docs/feed.xml
@@ -1 +1 @@
<rss xmlns:dc=http://purl.org/dc/elements/1.1/ xmlns:atom=http://www.w3.org/2005/Atom version=2.0><channel><title>Pushword - Modern CMS to build rapidly Websites (powered by Symfony)</title> <link>https://pushword.piedweb.com/ <description></description> <link href=https://pushword.piedweb.com/feed.xml rel=self type=application/rss+xml> <item><title></title> <link>https://pushword.piedweb.com/architecture <guid>https://pushword.piedweb.com/architecture</guid> <pubdate>Sat, 20 Feb 2021 10:48:06 +0100</pubdate></item> <item><title></title> <link>https://pushword.piedweb.com/command <guid>https://pushword.piedweb.com/command</guid> <pubdate>Sat, 20 Feb 2021 10:48:06 +0100</pubdate></item> <item><title></title> <link>https://pushword.piedweb.com/component/entity-filter <guid>https://pushword.piedweb.com/component/entity-filter</guid> <pubdate>Sat, 20 Feb 2021 10:48:06 +0100</pubdate></item> <item><title></title> <link>https://pushword.piedweb.com/configuration <guid>https://pushword.piedweb.com/configuration</guid> <pubdate>Sat, 20 Feb 2021 10:48:06 +0100</pubdate></item> <item><title></title> <link>https://pushword.piedweb.com/contribute <guid>https://pushword.piedweb.com/contribute</guid> <pubdate>Sat, 20 Feb 2021 10:48:06 +0100</pubdate></item></channel> </rss>
<rss xmlns:dc=http://purl.org/dc/elements/1.1/ xmlns:atom=http://www.w3.org/2005/Atom version=2.0><channel><title>Pushword - Modern CMS to build rapidly Websites (powered by Symfony)</title> <link>https://pushword.piedweb.com/ <description></description> <link href=https://pushword.piedweb.com/feed.xml rel=self type=application/rss+xml> <item><title></title> <link>https://pushword.piedweb.com/architecture <guid>https://pushword.piedweb.com/architecture</guid> <pubdate>Sat, 20 Feb 2021 11:25:44 +0100</pubdate></item> <item><title></title> <link>https://pushword.piedweb.com/command <guid>https://pushword.piedweb.com/command</guid> <pubdate>Sat, 20 Feb 2021 11:25:44 +0100</pubdate></item> <item><title></title> <link>https://pushword.piedweb.com/component/entity-filter <guid>https://pushword.piedweb.com/component/entity-filter</guid> <pubdate>Sat, 20 Feb 2021 11:25:44 +0100</pubdate></item> <item><title></title> <link>https://pushword.piedweb.com/configuration <guid>https://pushword.piedweb.com/configuration</guid> <pubdate>Sat, 20 Feb 2021 11:25:44 +0100</pubdate></item> <item><title></title> <link>https://pushword.piedweb.com/contribute <guid>https://pushword.piedweb.com/contribute</guid> <pubdate>Sat, 20 Feb 2021 11:25:44 +0100</pubdate></item></channel> </rss>
2 changes: 1 addition & 1 deletion docs/roadmap.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Expand Up @@ -4,5 +4,5 @@ import { editorJsHelper } from "./editorJsHelper.js";
window.editorJsHelper = new editorJsHelper();

window.addEventListener("load", function () {
new editorJs();
window.editors = new editorJs().getEditors();
});
5 changes: 5 additions & 0 deletions packages/admin-block-editor/src/assets/editor.js
Expand Up @@ -59,6 +59,10 @@ export class editorJs {
this.initEditor(editorjsConfig);
}

getEditors() {
return this.editors;
}

initEditor(config) {
if (typeof config.holder === "undefined") {
return;
Expand Down Expand Up @@ -95,6 +99,7 @@ export class editorJs {
},
})
);

this.editors[config.holder] = editor;
}

Expand Down
3 changes: 1 addition & 2 deletions packages/admin-block-editor/tests/ControllerTest.php
Expand Up @@ -2,14 +2,13 @@

namespace Pushword\AdminBlockEditor\Tests;

use Pushword\Admin\Tests\AbstractAdminTest;
use App\Entity\Page;
use Pushword\Admin\Tests\AbstractAdminTest;

class ControllerTest extends AbstractAdminTest
{
public function testIt()
{

$client = $this->loginUser(
//static::createPantherClient([ 'webServerDir' => __DIR__.'/../../skeleton/public' ])
);
Expand Down
40 changes: 19 additions & 21 deletions packages/admin/src/Resources/assets/admin.js
Expand Up @@ -67,23 +67,27 @@ function autoSizeTextarea() {

jQuery.extend(jQuery.expr[":"], {
focusable: function (el, index, selector) {
return $(el).is(
'textarea:not([style*="display: none"]),input,.CodeMirror-lines'
);
return $(el).is('textarea:not([style*="display: none"]),input,.CodeMirror-lines');
},
});

function textareaWithoutNewLine() {
$(document).on("keypress", ".textarea-no-newline", function (e) {
if ((e.keyCode || e.which) == 13) {
var $canfocus = $(":focusable");
var $canfocus = $(":focusable:visible,.editorjs-holder");
var index = $canfocus.index(this) + 1;
if (index >= $canfocus.length) index = 0;
$canfocus.eq(index).focus();
$canfocus.eq(index).attr("class") == "editorjs-holder"
? focusEditorJs($canfocus.eq(index))
: $canfocus.eq(index).focus();
return false;
}
});
}
function focusEditorJs(editorJsHolder) {
const id = editorJsHolder.attr("id");
window.editors[id].focus();
}
function copyElementText(element) {
var text = element.innerText;
var elem = document.createElement("textarea");
Expand All @@ -106,8 +110,7 @@ function showTitlePixelWidth() {
resultWrapper.innerHTML = input.value;
var titleWidth = resultWrapper.offsetWidth;
resultWrapper.innerHTML = titleWidth + "px";
resultWrapper.style =
titleWidth > 560 ? "color:#B0413E" : "color:#4F805D";
resultWrapper.style = titleWidth > 560 ? "color:#B0413E" : "color:#4F805D";
}
updateTitleWidth();
input.addEventListener("input", updateTitleWidth);
Expand All @@ -131,8 +134,7 @@ function memorizeOpenPannel() {
$(".collapse").on("shown.bs.collapse", function () {
var active = $(this).attr("id");
var panels =
localStorage.panels === "undefined" ||
localStorage.panels === undefined
localStorage.panels === "undefined" || localStorage.panels === undefined
? new Array()
: JSON.parse(localStorage.panels);
if ($.inArray(active, panels) == -1) panels.push(active);
Expand All @@ -142,8 +144,7 @@ function memorizeOpenPannel() {
$(".collapse").on("hidden.bs.collapse", function () {
var active = $(this).attr("id");
var panels =
localStorage.panels === "undefined" ||
localStorage.panels === undefined
localStorage.panels === "undefined" || localStorage.panels === undefined
? new Array()
: JSON.parse(localStorage.panels);
var elementIndex = $.inArray(active, panels);
Expand All @@ -155,8 +156,7 @@ function memorizeOpenPannel() {

function onInit() {
var panels =
localStorage.panels === "undefined" ||
localStorage.panels === undefined
localStorage.panels === "undefined" || localStorage.panels === undefined
? new Array()
: JSON.parse(localStorage.panels);

Expand All @@ -171,14 +171,12 @@ function memorizeOpenPannel() {
onErrorOpenPanel();

function onErrorOpenPanel() {
document
.querySelectorAll(".sonata-ba-field-error-messages")
.forEach(function (element) {
var panel = element.closest(".collapse");
if (panel) {
$(panel).collapse("show");
}
});
document.querySelectorAll(".sonata-ba-field-error-messages").forEach(function (element) {
var panel = element.closest(".collapse");
if (panel) {
$(panel).collapse("show");
}
});
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/Resources/public/admin.js

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions packages/core/src/Repository/PageRepository.php
Expand Up @@ -183,18 +183,14 @@ private function orderBy(QueryBuilder $qb, array $orderBy): QueryBuilder
{
if ([] === $orderBy) {
return $qb;
dd(debug_backtrace());
exit();
}

$key = implode(',', array_map(
function ($item) use ($qb) { return $this->getRootAlias($qb).'.'.$item; },
explode(',', $orderBy['key'] ?? $orderBy[0])
));

if (! empty($orderBy)) {
$qb->orderBy($key, $orderBy['direction'] ?? $orderBy[1]);
}
$qb->orderBy($key, $orderBy['direction'] ?? $orderBy[1] ?? 'DESC');

return $qb;
}
Expand Down
4 changes: 1 addition & 3 deletions packages/docs/content/roadmap.md
Expand Up @@ -17,9 +17,7 @@ parent: contribute

## Soon

- [WIP] **Block editor** :
- textarea no new line make jump to .editorjs-holder too
- Edition avancée (template notamment dans pages, prose/unprise)
- **Block editor** : édition avancée (template notamment dans pages, prose/unprise)
- **Prose/Unprose** : Avoid empty prose div : (see two block unprose one after the other)
- **clickable**
- associé un champ vidéo à l'image d'en-tête (plugin !)
Expand Down
Binary file modified packages/skeleton/var/app.db
Binary file not shown.
6 changes: 6 additions & 0 deletions packages/static-generator/src/Generator/RobotsGenerator.php
Expand Up @@ -37,6 +37,12 @@ protected function generateSitemap($locale, $format)

protected function generateFeed($locale)
{
if (! $this->getPageRepository()->getPage('homepage', $this->app->getMainHost())) {
return;
// we can't generate main feed if no homepage exist
// because mainFeed rely on homepage data
}

$liveUri = $this->generateLivePathFor(
$this->app->getMainHost(),
'pushword_page_main_feed',
Expand Down
5 changes: 3 additions & 2 deletions packages/static-generator/src/StaticAppGenerator.php
Expand Up @@ -38,11 +38,11 @@ public function __construct(
*
* @return int the number of site generated
*/
public function generate(?string $host = null): int
public function generate(?string $hostToGenerate = null): int
{
$i = 0;
foreach ($this->apps->getHosts() as $host) {
if ($host && $host != $host) {
if ($hostToGenerate && $hostToGenerate != $host) {
continue;
}

Expand Down Expand Up @@ -74,6 +74,7 @@ protected function generateHost(?string $host)
$filesystem->mkdir($app->get('static_dir'));

foreach ($app->get('static_generators') as $generator) {
//dump($generator);
$this->generatorBag->get($generator)->generate();
}
}
Expand Down

0 comments on commit aad4d03

Please sign in to comment.