generated from halo-dev/plugin-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d40313
commit 797ddc3
Showing
9 changed files
with
96 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,5 +52,5 @@ build { | |
} | ||
|
||
halo { | ||
version = '2.15.0' | ||
version = '2.17.0' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
version=1.0.0 | ||
version=1.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/main/java/xin/wenjing/blogHao/processor/CopyAddHeadProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package xin.wenjing.blogHao.processor; | ||
|
||
import lombok.AllArgsConstructor; | ||
import org.springframework.stereotype.Component; | ||
import org.thymeleaf.context.ITemplateContext; | ||
import org.thymeleaf.model.IModel; | ||
import org.thymeleaf.model.IModelFactory; | ||
import org.thymeleaf.processor.element.IElementModelStructureHandler; | ||
import reactor.core.publisher.Mono; | ||
import run.halo.app.plugin.ReactiveSettingFetcher; | ||
import run.halo.app.theme.dialect.TemplateHeadProcessor; | ||
import xin.wenjing.blogHao.entity.Settings; | ||
import xin.wenjing.blogHao.util.ScriptContentUtils; | ||
|
||
/** | ||
* 功能描述 | ||
* 复制追加功能 | ||
* @author: dreamChaser | ||
* @date: 2024年06月16日 00:21 | ||
*/ | ||
@Component | ||
@AllArgsConstructor | ||
public class CopyAddHeadProcessor implements TemplateHeadProcessor { | ||
|
||
private final ReactiveSettingFetcher settingFetcher; | ||
|
||
@Override | ||
public Mono<Void> process( ITemplateContext context, IModel model, IElementModelStructureHandler structureHandler) { | ||
return settingFetcher.fetch(Settings.CopyAdd.GROUP_NAME, Settings.CopyAdd.class) | ||
.doOnNext( copyAdd -> { | ||
// 复制内容追加 | ||
if (copyAdd.isContentPageOnly() && ScriptContentUtils.notContentTemplate(context)) { | ||
return; | ||
} | ||
String copyAddScript = ScriptContentUtils.copyAddScrProcess(copyAdd.getCopyAddContent(), copyAdd.getDivideType(), copyAdd.getCopyMinLength()); | ||
final IModelFactory modelFactory = context.getModelFactory(); | ||
model.add(modelFactory.createText(copyAddScript)); | ||
}).then(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters