Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated patch for search api drush cmd #551

Merged
merged 7 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"drupal/maxlength": "^2.1",
"drupal/entity_hierarchy": "4.x",
"drupal/elasticsearch_connector": "^7.0",
"drupal/search_api": "^1.11",
"drupal/search_api": "^1.36",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"drupal/data_pipelines": "1.0.0-alpha22",
"drupal/data_pipelines_elasticsearch": "^1.0@alpha",
"drupal/key": "^1.17",
Expand Down Expand Up @@ -406,7 +406,7 @@
"[UX] Add the ability to hide or disable the import CSV option - https://www.drupal.org/project/tablefield/issues/2337743": "https://www.drupal.org/files/issues/2020-11-11/tablefield-allowed_data_sources-2337743-16.patch"
},
"drupal/search_api": {
"Provide drush support to index a specific entity - https://www.drupal.org/project/search_api/issues/3016809": "https://www.drupal.org/files/issues/2020-02-08/search_api-index-specific-items-3016809-09.patch"
"Provide drush support to index a specific entity - https://www.drupal.org/project/search_api/issues/3016809": "https://www.drupal.org/files/issues/2024-11-25/search_api-index-specific-items-3016809-10.patch"
},
"drupal/key": {
"KeyProviderInterface::getKeyValue() doesn't always return a string - https://www.drupal.org/project/key/issues/3356052#comment-15030602": "https://git.drupalcode.org/project/key/-/merge_requests/11/diffs.patch",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

use Drupal\ckeditor5\Plugin\CKEditor5PluginManagerInterface;
use Drupal\Component\Utility\Html;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Routing\CurrentRouteMatch;
use Drupal\filter\FilterProcessResult;
use Drupal\filter\Plugin\FilterBase;
use Psr\Container\ContainerInterface;
Expand All @@ -24,6 +22,11 @@
*/
class FilterResizeTableColumns extends FilterBase implements ContainerFactoryPluginInterface {

/**
* The CKEditor5 plugin manager.
*
* @var \Drupal\ckeditor5\Plugin\CKEditor5PluginManagerInterface
*/
protected CKEditor5PluginManagerInterface $ckeditor5PluginManager;

/**
Expand Down
7 changes: 4 additions & 3 deletions modules/tide_ckeditor/tide_ckeditor.install
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,17 @@ function tide_ckeditor_update_10002() {
if ($filter) {
// Add <colgroup>, <col>, and <col style> to allowed HTML.
$additional_allowed_tags = '<colgroup> <col> <col style>';
// Append the new tags to the allowed HTML, making sure not to add duplicates
// Append the new tags to the allowed HTML,
// making sure not to add duplicates.
$replaced = $allowed_html . ' ' . $additional_allowed_tags;
$replaced = trim($replaced, ',');
// Set the updated allowed HTML tags in the filter
// Set the updated allowed HTML tags in the filter.
$filter->set('filters.filter_html.settings.allowed_html', $replaced);

$filter->set('filters.filter_resize_tablecolumns', [
'id' => 'filter_resize_tablecolumns',
'provider' => 'ckeditor_tablecol_resize',
'status' => true,
'status' => TRUE,
'weight' => 99,
'settings' => [],
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ public function replaceUnicodeWhitespace(array $data) {
return $data;
}

/**
* Helper function to add table styles to processed field.
*/
public function addTableStylesToProcessed(&$data) {
// Check if 'value' and 'processed' keys exist in $data.
if (isset($data['value']) && isset($data['processed'])) {
Expand All @@ -91,7 +94,7 @@ public function addTableStylesToProcessed(&$data) {
$processedDom = new \DOMDocument();

// Suppress warnings for malformed HTML in $value and $processed.
libxml_use_internal_errors(true);
libxml_use_internal_errors(TRUE);
$valueDom->loadHTML($data['value']);
$processedDom->loadHTML($data['processed']);
libxml_clear_errors();
Expand All @@ -117,14 +120,14 @@ public function addTableStylesToProcessed(&$data) {
$processedCol = $processedCols->item($j);

if ($valueCol->hasAttribute('style')) {
// Parse the style attribute.
// Parse the style attribute.
$styleValue = $valueCol->getAttribute('style');
$styles = explode(';', $styleValue);

foreach ($styles as $style) {
$style = trim($style);
if (!empty($style)) {
list($property, $value) = explode(':', $style, 2);
[$property, $value] = explode(':', $style, 2);
$property = trim($property);
$value = trim($value);

Expand All @@ -149,4 +152,5 @@ public function addTableStylesToProcessed(&$data) {
}
return $data;
}

}